#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long A;
  cin >> n >> A;
  vector<int> a(n);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (int i = 0; i < n; i++) {
    int res = 0;
    if (A - (sum - a[i]) - 1 > 0) res += A - (sum - a[i]) - 1;
    if (A - (n - 1) < a[i]) res += a[i] - (A - (n - 1));
    cout << res << " ";
  }
  return 0;
}
