#include <bits/stdc++.h>
using namespace std;
long long val[200010], cnt[200010], Ans[200010];
long long sum = 0;
inline void solve(void) {
  long long n, A;
  cin >> n >> A;
  for (int i = (0); i < (n); i++) {
    cin >> val[i];
    sum += val[i];
  }
  for (int i = (0); i < (n); i++) {
    cnt[i] = sum - val[i];
  }
  for (int i = (0); i < (n); i++) {
    long long tmp = A - cnt[i];
    tmp = ((tmp) > (1) ? tmp : 1);
    Ans[i] = tmp - 1;
    tmp = A - (n - 1);
    if ((val[i] - tmp) > 0) Ans[i] += val[i] - tmp;
  }
  for (int i = (0); i < (n); i++) cout << Ans[i] << " ";
}
int main(int argc, const char* argv[]) {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
