#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long mod1 = 998244353;
const long long inf = 92233720000000000ll;
const long long nax = 200005;
long long d[nax];
long long n, a;
void solve() {
  cin >> n >> a;
  long long sum = 0;
  for (long long i = (0); i < (n); i++) {
    cin >> d[i];
    sum += d[i];
  }
  for (long long i = (0); i < (n); i++) {
    long long mn = max(1ll, a - sum + d[i]);
    long long mx = min(d[i], a - n + 1);
    cout << d[i] - (mx - mn + 1) << " ";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
