#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n = 0;
  lli A = 0ll;
  cin >> n >> A;
  vector<int> d(n);
  for (auto &i : d) cin >> i;
  lli sum = accumulate(d.begin(), d.end(), 0ll);
  for (int i = 0; i < n; ++i) {
    lli res = 0ll, mx = sum - d[i], r = A - mx;
    if (r > 1ll) res += (r - 1ll);
    lli mi = n - 1ll;
    r = A - mi;
    if (r < d[i]) res += (d[i] - r);
    cout << res << " ";
  }
}
