#include <bits/stdc++.h>
using namespace std;
# define rep(i,a,b) for(int i=(a); i<=(b); ++i)
typedef long long int_;
inline int_ readint(){
	int_ a = 0; char c = getchar(), f = 1;
	for(; c<'0'||c>'9'; c=getchar())
		if(c == '-') f = -f;
	for(; '0'<=c&&c<='9'; c=getchar())
		a = (a<<3)+(a<<1)+(c^48);
	return a*f;
}
inline void writeint(int_ x){
	if(x < 0) putchar('-'), x = -x;
	if(x > 9) writeint(x/10);
	putchar((x-x/10*10)^48);
}

const int MaxN = 1000001;

struct Range{
	int_ l, r;
	Range(int_ L,int_ R){
		l = L, r = R;
	}
	bool check(int_ x){
		return l <= x && x <= r;
	}
};
deque<Range> lis;

int sgn; int_ adv;
# define unzip(x) (sgn*(x)+adv)
# define dozip(x) (((x)-adv)*sgn)

bool tag[MaxN];
int_ dif[MaxN], w[MaxN], sy[MaxN];

int main(){
	int n = readint(); readint();
	lis.push_back(Range(0,1e18));
	for(int i=sgn=1; i<=n-2; ++i){
		w[i] = readint();
# define oneMax ((~sgn) ? lis.back().r : lis.front().l)
# define twoMax ((~sgn) ? lis.back().l : lis.front().r)
		while(!lis.empty() && unzip(oneMax) > w[i])
			if(unzip(twoMax) <= w[i]){
				oneMax = dozip(w[i]); break;
			} else if(~sgn) lis.pop_back();
				else lis.pop_front();
		// printf("i = %d, STRUCTION:",i);
		// for(auto it=lis.begin(); it!=lis.end(); ++it)
		// 	printf(" [%lld,%lld]",unzip(it->l),unzip(it->r));
		// puts("");
# define meow(cat) cat.check(dozip(w[i]))
		if(lis.empty() == false)
		if(meow(lis.front()) or meow(lis.back())){
			tag[i] = true, lis.clear();
			lis.push_back(Range(0,w[i]));
			sgn = 1, adv = 0; continue;
		}
# define oneMin ((~sgn) ? lis.front().l : lis.back().r)
		bool corner = !lis.empty()
			and unzip(oneMin) != w[i];
		sgn = -sgn, adv = -adv+w[i];
		if(corner && unzip(oneMax) != w[i]){
			if(sgn == -1)
				lis.push_front(Range(
				dozip(w[i]),dozip(w[i])));
			else lis.push_back(Range(
				dozip(w[i]),dozip(w[i])));
		}
		if(lis.empty()){
			puts("NO"); return 0;
		}
		sy[i] = unzip(oneMin); // record
		// printf("i = %d, STRUCTION:",i);
		// for(auto it=lis.begin(); it!=lis.end(); ++it)
		// 	printf(" [%lld,%lld]",unzip(it->l),unzip(it->r));
		// puts("");
	}
	if(lis.empty()){
		puts("NO"); return 0;
	} else puts("YES");
	int_ now = unzip(oneMin); // whatever
	for(int i=(n-2)*(sgn=1); i>=1; --i){
		dif[i] = now*sgn, sgn = -sgn;
		if(tag[i]) now = w[i];
		else if(now == w[i])
			now = sy[i-1];
		else{
			now = w[i]-now;
			sgn = -sgn;
		}
	}
	dif[0] = now*sgn; int_ low = 0;
	rep(i,now=0,n-2) // find valley
		low = min(low,now += dif[i]);
	writeint(now = -low);
	rep(i,0,n-2){
		putchar(' ');
		writeint(now += dif[i]);
	}
	putchar('\n');
	return 0;
}