#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long A;
  cin >> n >> A;
  vector<int> dices;
  long long s = 0;
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    dices.push_back(tmp);
    s += tmp;
  }
  for (int i = 0; i < n; ++i) {
    int Min = 1, Max = dices[i];
    long long t1 = A - (s - dices[i]);
    if (t1 > Min) Min = t1;
    long long t2 = A - (n - 1);
    if (t2 < Max) Max = t2;
    cout << dices[i] - (Max - Min + 1);
    if (i != n - 1) cout << " ";
  }
  cout << endl;
  return 0;
}
