#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a;
  cin >> n >> a;
  long long int l[200001], ans[200001];
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  long long int s = 0;
  for (int i = 0; i < n; i++) {
    s = s + l[i];
  }
  for (int i = 0; i < n; i++) {
    long long int min, max;
    if (s - l[i] >= a) {
      min = 1;
    } else {
      min = a - (s - l[i]);
    }
    if (a - n + 1 >= l[i]) {
      max = l[i];
    } else {
      max = a - n + 1;
    }
    ans[i] = l[i] - (max - min + 1);
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  printf("\n");
  return 0;
}
