#include <bits/stdc++.h>
using namespace std;
int d[(int)1e6 + 10];
long long sum;
int main() {
  ios_base::sync_with_stdio(0);
  long long n, A;
  cin >> n >> A;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    sum += d[i];
  }
  for (int i = 0; i < n; i++) {
    long long tmp = A;
    tmp -= (sum - d[i]);
    tmp--;
    tmp = max(tmp, 0ll);
    if ((long long)d[i] > A - n + 1) tmp += (long long)d[i] - A + n - 1;
    cout << max(tmp, 0ll) << " ";
  }
}
