#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, i;
  long long s, p, q, r;
  cin >> n >> s;
  long long a[n], sum = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (i = 0; i < n; i++) {
    p = min(s - 1, sum - a[i]);
    q = n - 1;
    p = s - p;
    q = s - q;
    if (a[i] > q) {
      r = q - p + 1;
    } else {
      r = a[i] - p + 1;
    }
    cout << a[i] - r << " ";
  }
  return 0;
}
