#include <bits/stdc++.h>

using namespace std;

int n;
long long bound;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> bound;
  vector<long long> w(n - 2);
  for (int i = 0; i < n - 2; i++) {
    cin >> w[i];
  }
  long long L = 0, R = bound;
  deque<long long> cur;
  long long delta = 0;
  int mu = 1;
  auto get_max = [&]() {
    assert(cur.size());
    long long v = mu == 1 ? cur.back() : cur.front();
    return v * mu + delta;
  };
  auto rev_max = [&]() {
    assert(cur.size());
    mu == 1 ? cur.pop_back() : cur.pop_front();
  };
  vector<long long> change(n - 2, -1);
  auto solve = [&]() {
    for (int b = 0; b < n - 2; b++) {
      long long W = w[b];
      R = min(R, W);
      while (cur.size() && get_max() > W) {
        rev_max();
      }
      if ((L <= R && L <= W && W <= R) || (cur.size() && get_max() == W)) {
        L = 0;
        R = W;
        change[b] = W;
        cur.clear();
        delta = 0;
        mu = 1;
      } else {
        if (L <= R && L <= W) {
          change[b] = L;
        } else if (cur.size()) {
          change[b] = get_max();
        } else {
          return -1LL;
        }
        L = W - L;
        R = W - R;
        swap(L, R);
        delta = W - delta;
        mu *= -1;
        // add * mu + delta == W
        long long add = (W - delta) / mu;
        if (cur.size() && get_max() == W) {
          continue;
        }
        if (mu == -1) {
          cur.push_front(add);
        } else {
          cur.push_back(add);
        }
      }
    }
    if (L <= R) {
      return R;
    } else {
      assert(cur.size());
      return get_max();
    }
  };
  long long last = solve();
  assert(last >= -1);
  if (last == -1) {
    cout << "NO";
    return 0;
  }
  cout << "YES\n";
  vector<long long> diff = {last};
  for (int i = n - 3; i >= 0; i--) {
    long long W = w[i];
    long long pr = change[i];
    assert(pr != -1);
    assert(pr <= W && last <= W);
    if (pr == W) {
      // found W
      last = (last > 0 ? -W : W);
    } else {
      if (abs(last) == W) {
        last = (last > 0 ? -pr : pr);
      } else {
        if (last < 0) {
          last = abs(last) - W;
        } else {
          last = W - last;
        }
      }
    }
    diff.push_back(last);
  }
  reverse(diff.begin(), diff.end());
  vector<long long> a(n);
  for (int i = 1; i < n; i++) {
    a[i] = a[i - 1] + diff[i - 1];
  }
  long long add = *min_element(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    cout << a[i] - add << " ";
  }
  return 0;
}
