#include <bits/stdc++.h>
using namespace std;
long long n, i, j, k, l, T, A, s = 0, rs;
vector<long long> d(200010), b(200010), s1(200010);
int main() {
  cin >> n >> A;
  for (i = 0; i < n; i++) {
    cin >> d[i];
    s += d[i];
  }
  for (i = 0; i < n; i++) {
    rs = s - d[i];
    T = 0;
    if (d[i] <= A - (n - 1) and 1 <= A - rs) {
      T += d[i] - (A - rs) + 1;
    }
    if (d[i] > A - (n - 1) and 1 <= A - rs) {
      T += A - (n - 1) - (A - rs) + 1;
    }
    if (d[i] <= A - (n - 1) and 1 > A - rs) {
      T += d[i];
    }
    if (d[i] > A - (n - 1) and 1 > A - rs) {
      T += A - (n - 1);
    }
    cout << d[i] - T << " ";
  }
}
