#include<cstdio>
struct Data {
int min,max;
int delta; //为了实现对YES情况先选择总计的minTime,记录maxTime与minTime的差值
}D[31],sum;
int main() {
int d,t;
scanf("%d%d",&d,&t);
for(int i=0;i<d;++i) {
scanf("%d%d",&D[i].min,&D[i].max);
D[i].delta=D[i].max-D[i].min;
sum.min+=D[i].min;
sum.max+=D[i].max;
}
if(sum.max<t||sum.min>t)
printf("NO");
else {
printf("YES\n");
t-=sum.min; //先选择总计的minTime
for(int i=0;i<d;++i) {
if(t>=D[i].delta) { //贪心地选择
printf("%d ",D[i].max);
t-=D[i].delta;
}
else {
printf("%d ",t+D[i].min);
t=0;
}
}
}
return 0;
}