#include <bits/stdc++.h>
using namespace std;
long long a[200005];
int main() {
  long long n, A;
  long long tot = 0;
  cin >> n >> A;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    tot += a[i];
  }
  for (int i = 0; i < n; i++) {
    long long up = min(A - (n - 1), a[i]);
    long long down = max(1ll, A - (tot - a[i]));
    printf("%d ", a[i] - (up - down) - 1);
  }
  return 0;
}
