#include <bits/stdc++.h>
using namespace std;
long long int scan() {
  long long int t = 0;
  char c, ch;
  ch = getchar();
  if (ch == '-') {
    c = getchar();
  } else {
    c = ch;
  }
  while (c < '0' || c > '9') {
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    t = (t << 3) + (t << 1) + c - '0';
    c = getchar();
  }
  if (ch == '-') {
    return -t;
  } else {
    return t;
  }
}
int main() {
  ios::sync_with_stdio(false);
  long long int i, j, k, t, n, m, x, y, sum = 0;
  vector<long long> v, sumy, maxi, mini;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> x;
    sum += x;
    v.push_back(x);
  }
  for (i = 0; i < n; i++) {
    long long mm = m;
    y = sum - v[i];
    long long req = mm - y;
    mini.push_back(max(req, 1LL));
    y -= (n - 1);
    mm -= (n - 1);
    maxi.push_back(min(v[i], mm));
  }
  for (i = 0; i < n; i++) {
    cout << v[i] - (maxi[i] - mini[i] + 1) << " ";
  }
  return 0;
}
