#include <bits/stdc++.h>
using namespace std;
int n, i, d[200005], ans[200005];
long long A, sum;
int main() {
  cin >> n >> A;
  sum = 0;
  for (i = 1; i <= n; i++) {
    cin >> d[i];
    sum += d[i];
  }
  for (i = 1; i <= n; i++) {
    if (1LL * d[i] > (A - 1LL * n + 1)) ans[i] = 1LL * d[i] - A + 1LL * n - 1;
    if (A - sum + 1LL * d[i] - 1 > 0) ans[i] += (A - sum + 1LL * d[i] - 1);
  }
  for (i = 1; i < n; i++) cout << ans[i] << " ";
  cout << ans[n] << endl;
  return 0;
}
