#include <bits/stdc++.h>
using namespace std;
long long d[200001];
int main() {
  int n;
  long long A;
  long long mins, maxs;
  cin >> n >> A;
  mins = n - 1;
  maxs = 0;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    maxs += d[i];
  }
  for (int i = 0; i < n; i++) {
    long long minpos =
        max(static_cast<long long>(1), min(d[i], A - (maxs - d[i])));
    long long maxpos = min(d[i], max(1ll, A - mins));
    long long ans = abs(minpos - maxpos) + 1;
    cout << d[i] - ans << " ";
  }
  puts("");
}
