#include <bits/stdc++.h>
using namespace std;
long long n, a, s, d[200004];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a;
  for (int i = 0; i < n; i++) cin >> d[i], s += d[i];
  for (int i = 0; i < n; i++) {
    long long ans = 0;
    ans += (d[i] - a + n - 1 > 0) ? d[i] - a + n - 1 : 0;
    ans += (a - s + d[i] > 1) ? a - s + d[i] - 1 : 0;
    if (s == a || n == a) ans = d[i] - 1;
    cout << ans << " ";
  }
  return 0;
}
