#include <bits/stdc++.h>
using namespace std;
int a[300000];
int main() {
  ios::sync_with_stdio(false);
  long long n, A;
  cin >> n >> A;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    if (a[i] > A - n + 1) ans += a[i] - A + n - 1;
    if (sum - a[i] < A) ans += A - sum + a[i] - 1;
    cout << ans << " ";
  }
  return 0;
}
