#include <bits/stdc++.h>
using namespace std;
void hehe() {
  long long int n, a;
  cin >> n >> a;
  vector<long long int> arr(n);
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  for (int i = 0; i < n; i++) {
    long long int x, y;
    x = max(1ll, a - (sum - arr[i]));
    y = min(arr[i], a - (n - 1));
    cout << arr[i] - (y - x + 1) << " ";
  }
}
int main() {
  int t = 1;
  while (t--) {
    hehe();
  }
  return 0;
}
