#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a, S = 0;
  cin >> n >> a;
  long long int dice[n + 5];
  for (int i = 0; i < n; i++) {
    cin >> dice[i];
    S += dice[i];
  }
  for (int i = 0; i < n; i++) {
    long long int mn, mx;
    mn = a - (S - dice[i]);
    mx = max((long long int)0, dice[i] - (a - (n - 1)));
    mn = a - min(S - dice[i], a - 1) - 1;
    cout << mx + mn << " ";
  }
  cout << endl;
  return 0;
}
