#include <bits/stdc++.h>
using namespace std;
long long n, a, d[222222], s, S, A;
long long solve(int i) {
  S = max(S, 1ll);
  A = min(A, d[i]);
  return d[i] - A + S - 1;
}
int main() {
  cin >> n >> a;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    s += d[i];
  }
  for (int i = 0; i < n; i++) {
    S = a - (s - d[i]);
    A = a - n + 1ll;
    cout << solve(i) << " ";
  }
  return 0;
}
