#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
long long n, sum;
int a[maxn], ans[maxn];
int main() {
  scanf("%I64d%I64d", &n, &sum);
  long long tot = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    tot += a[i];
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] > sum - n + 1) ans[i] += a[i] - (sum - n + 1);
    if (sum - 1 > tot - a[i]) ans[i] += sum - 1 - (tot - a[i]);
  }
  for (int i = 1; i <= n; i++) printf("%d%c", ans[i], i == n ? '\n' : ' ');
  return 0;
}
