#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
int n;
long long A, D[MAXN];
int main() {
  scanf("%d %I64d", &n, &A);
  long long s = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &D[i]);
    s += D[i];
  }
  for (int i = 1; i <= n; i++) {
    long long minimum = max(1LL, (A - (s - D[i])));
    long long maximum = min(D[i], A - (n - 1));
    printf("%I64d ", minimum - 1 + D[i] - maximum);
  }
  return 0;
}
