#include <bits/stdc++.h>
using namespace std;
const int N = 200009;
long long d[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, A, sum = 0, x;
  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 upper = min(d[i], A - (n - 1));
    long long lower = max(1ll, A + d[i] - sum);
    cout << d[i] - (upper - lower + 1) << " ";
  }
  cout << endl;
}
