#include <bits/stdc++.h>
using namespace std;
const int maxiz = 1000 * 1000 + 100;
int d[maxiz];
int main() {
  int n;
  long long A, M = 0;
  cin >> n >> A;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    M = (M + d[i] * 1ll) * 1ll;
  }
  for (int i = 0; i < n; i++) {
    long long maxi, mini;
    if (A - M + d[i] > 1)
      mini = A - (M - d[i]);
    else
      mini = 1;
    if (d[i] < A - n + 1)
      maxi = d[i];
    else
      maxi = A - n + 1;
    cout << d[i] - (maxi - mini + 1) << " ";
  }
}
