#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double epsilon = 1e-9;
const int oo = 1e9 + 10;
void solve() {
  long long int n, a;
  cin >> n >> a;
  long long int sum = 0;
  vector<long long int> d(n);
  for (auto &i : d) {
    cin >> i;
    sum += i;
  }
  for (long long int i = 0; i < n; i++) {
    long long int upper_lim = a - (n - 1);
    long long int lower_lim = a - (sum - d[i]);
    upper_lim = min(d[i], upper_lim);
    lower_lim = max(1LL, lower_lim);
    cout << d[i] - (upper_lim - lower_lim + 1) << " ";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
