#include <bits/stdc++.h>
using namespace std;
int d[200009];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, sum, dsum = 0;
  cin >> n >> sum;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    dsum += d[i];
  }
  for (int i = 0; i < n; i++) {
    long long up_limit = max(0ll, d[i] - (sum - (n - 1)));
    long long low_limit = sum - min(dsum - d[i], sum - 1) - 1;
    cout << up_limit + low_limit << " ";
  }
}
