#include <bits/stdc++.h>
using namespace std;
const int MOD(1000000007);
const int INF((1 << 30) - 1);
const int MAXN(200005);
int a[MAXN];
int main() {
  int n;
  long long s;
  scanf("%d%I64d", &n, &s);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  for (int i = 0; i < n; i++) {
    int low, high;
    if (sum - a[i] >= s)
      low = 1;
    else
      low = s - (sum - a[i]);
    if (a[i] + n - 1 <= s)
      high = a[i];
    else
      high = s - (n - 1);
    printf("%d ", max(0, (low - 1) + (a[i] - high)));
  }
}
