#include <bits/stdc++.h>
using namespace std;
int d[200001];
int main() {
  int n, i;
  long long a;
  scanf("%d%I64d", &n, &a);
  long long s = 0, l, r;
  for (i = 0; i < n; i++) {
    scanf("%d", &d[i]);
    s += (long long)d[i];
  }
  for (i = 0; i < n; i++) {
    l = a - (s - d[i]);
    l = max(l, 1LL);
    r = a - (n - 1);
    r = min((long long)d[i], r);
    printf("%I64d ", (long long)d[i] - (r - l + 1));
  }
  return 0;
}
