#include <bits/stdc++.h>
using namespace std;
void solve(long long int T) {
  long long int n, d;
  cin >> n >> d;
  vector<long long int> arr(n);
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  for (long long int i = 0; i < n; i++) {
    long long int xsum = sum - arr[i];
    long long int atleast = max(1ll, d - xsum);
    long long int atmost = min(arr[i], d - (n - 1));
    long long int ans = (arr[i] - (atmost - atleast + 1));
    cout << ans << " ";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T = 1;
  for (long long int t = 1; t <= T; t++) {
    solve(t);
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
