#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, A, sum = 0, i;
  cin >> n >> A;
  long long int arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  for (i = 0; i < n; i++) {
    cout << max(0LL, A - (sum - arr[i]) - 1) + max(0LL, n - 1 + arr[i] - A)
         << " ";
  }
  cout << endl;
  return 0;
}
