#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, A, i, x;
  cin >> n >> A;
  long long a[n], sum = 0;
  for (i = 0; i < n; i++) cin >> a[i], sum += a[i];
  long long mx, mn;
  for (i = 0; i < n; i++) {
    mx = A - (n - 1);
    mn = A - (sum - a[i]);
    mx = a[i] - mx;
    if (mx < 0) mx = 0;
    mn--;
    if (mn < 0) mn = 0;
    cout << mx + mn << " ";
  }
}
