#include <bits/stdc++.h>
using namespace std;
long long int d[200001];
int main() {
  long long int i, j, n, m, mx = 0, x, a, w, ww, low, high, tot;
  scanf("%lld", &n);
  scanf("%lld", &a);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &d[i]);
    mx += d[i];
  }
  for (i = 1; i <= n; i++) {
    w = mx - d[i];
    ww = n - 1;
    x = a - ww;
    if (x <= d[i])
      high = x;
    else
      high = d[i];
    x = a - w;
    if (x <= 1)
      low = 1;
    else
      low = x;
    tot = high - low + 1;
    tot = d[i] - tot;
    cout << tot << " ";
  }
  cout << endl;
  return 0;
}
