#include <bits/stdc++.h>
using namespace std;
int n;
int mas[200005];
long long A, s;
int main() {
  scanf("%d %I64d", &n, &A);
  for (int i = 0; i < n; i++) {
    scanf("%d", &mas[i]);
    s += mas[i];
  }
  for (int i = 0; i < n; i++) {
    int res = 0;
    long long diff = s - mas[i];
    diff = max(1ll, A - diff);
    res += diff - 1;
    diff = A - n + 1;
    res += max((long long)mas[i] - diff, 0ll);
    printf("%d ", res);
  }
  return 0;
}
