#include <stdio.h>
#include <string.h>

#define N	1000000

long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }

int main() {
	static long long ww[N], xx[N], dd[N], aa[N];
	static int rr[N], qu[2][N], cnt[2];
	static char same[N];
	int n, i, j, p, sgn;
	long long c, a_;

	scanf("%d%lld", &n, &c);
	for (i = 2; i < n; i++) {
		scanf("%lld", &ww[i]);
		xx[i] = ww[i] - xx[i - 1];
	}
	for (i = n - 1; i >= 1; i--) {
		int lower, upper;

		p = i % 2;
		while (cnt[p] && xx[qu[p][cnt[p] - 1]] > xx[i])
			cnt[p]--;
		if (i + 1 < n)
			rr[i + 1] = cnt[p] ? qu[p][cnt[p] - 1] : n;
		qu[p][cnt[p]++] = i;
		lower = -1, upper = cnt[p ^ 1];
		while (upper - lower > 1) {
			int h = (lower + upper) / 2;

			if (xx[qu[p ^ 1][h]] > -xx[i])
				upper = h;
			else
				lower = h;
		}
		if (i + 1 < n && lower != -1)
			rr[i + 1] = min(rr[i + 1], qu[p ^ 1][lower]);
	}
	memcpy(dd, ww, n * sizeof *dd), dd[1] = ww[2];
	for (i = 2; i < n; i++) {
		if (i + 1 < n && ww[i] < ww[i + 1]) {
			long long l, r, tmp;

			l = 0, r = ww[i], j = i + 1;
			while (j < n) {
				tmp = l, l = ww[j] - r, r = ww[j] - tmp;
				if (r < 0)
					break;
				else if (l <= 0) {
					dd[i] = (j - i) % 2 == 0 ? -(xx[j] - xx[i]) : xx[j] + xx[i];
					i = j - 1;
					goto next;
				}
				same[j++] = 1;
			}
			if (j == n)
				break;
			for (i++; i < j; i++) {
				if (j < rr[i]) {
					same[i] = 0;
					while (j < rr[i])
						same[j++] = 1;
				}
				if (j == n)
					goto out;
				if (xx[rr[i]] - (rr[i] % 2 == (i - 1) % 2 ? xx[i - 1] : -xx[i - 1]) == 0) {
					while (--j >= rr[i])
						same[j] = 0;
					same[i] = 0, i = rr[i] - 1;
					goto next;
				}
			}
			printf("NO\n");
			return 0;
		} else
			dd[i] = ww[i + 1];
next:;
	}
out:
	sgn = 1;
	for (i = 1; i < n; i++) {
		if (i > 1) {
			if (same[i])
				dd[i] -= dd[i - 1];
			else
				sgn = -sgn;
		}
		aa[i] = aa[i - 1] + dd[i] * sgn;
	}
	a_ = 0;
	for (i = 0; i < n; i++)
		a_ = min(a_, aa[i]);
	for (i = 0; i < n; i++)
		aa[i] -= a_;
	printf("YES\n");
	for (i = 0; i < n; i++)
		printf("%lld ", aa[i]);
	printf("\n");
	return 0;
}
