#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, A;
  cin >> n >> A;
  long long* d = new long long[n];
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    sum += d[i];
  }
  long long l = 1;
  long long ans;
  for (int i = 0; i < n; i++) {
    ans = d[i] - 1;
    ans += max(l, A + d[i] - sum);
    ans -= min(d[i], A - n + 1);
    cout << ans << " ";
  }
  return 0;
}
