#include <bits/stdc++.h>
using namespace std;
long long a[200005];
int main() {
  long long n, A;
  cin >> n >> A;
  long long sum = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (n == 1) {
    cout << a[1] - 1 << endl;
    return 0;
  }
  long long tmp = sum - A;
  if (tmp == 0) {
    for (long long i = 1; i <= n; i++) {
      if (i == 1)
        cout << a[i] - 1;
      else
        cout << " " << a[i] - 1;
    }
    cout << endl;
    return 0;
  }
  for (long long i = 1; i <= n; i++) {
    long long l, r;
    if (i != 1) cout << " ";
    long long tmp = sum - a[i] - A;
    if (tmp < 0)
      l = -tmp;
    else
      l = 1;
    r = A - n + 1;
    if (r >= a[i]) r = a[i];
    cout << a[i] - (r - l + 1);
  }
  cout << endl;
  return 0;
}
