#include <bits/stdc++.h>
using namespace std;
const double EPS = 1E-12;
const long long mod = 1000000007;
using namespace std;
long long n;
long long a;
long long d[200005];
long long sum;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> a;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    sum += d[i];
  }
  for (int i = 0; i < n; i++) {
    long long low = n - 1;
    long long rest = sum - d[i];
    long long melow = max(1LL, a - rest);
    long long mehigh = min(d[i], a - low);
    if (melow > mehigh)
      cout << d[i];
    else
      cout << d[i] - (mehigh - melow + 1);
    cout << ' ';
  }
  cout << endl;
  return 0;
}
