#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:167177216")
using namespace std;
const int MAXN = 9;
int main() {
  long long n, A;
  scanf("%I64d %I64d", &n, &A);
  long long sum = 0;
  vector<int> d(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &d[i]);
    sum += d[i];
  }
  for (int i = 0; i < n; i++) {
    long long without = sum - d[i];
    long long need = A - without;
    if (need <= 0) {
      long long need = A - (n - 1);
      if (d[i] <= need)
        cout << 0 << ' ';
      else {
        cout << d[i] - need << ' ';
      }
    } else {
      long long ans = need - 1;
      long long razn = d[i] - need;
      if (without - (n - 1) < razn) ans += (razn - without + (n - 1));
      cout << ans << ' ';
    }
  }
  return 0;
}
