#include <bits/stdc++.h>
using namespace std;
const int ARRS = 2e5 + 100;
int arr[ARRS];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  long long a;
  cin >> n >> a;
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    sum += arr[i];
  }
  long long mn = n - 1;
  for (int i = 0; i < n; ++i) {
    long long mx = sum - arr[i];
    long long low = max(mn, a - arr[i]);
    long long high = min(mx, a - 1);
    long long can = max(0LL, high - low + 1);
    cout << arr[i] - can << " ";
  }
  cout << "\n";
  return 0;
}
