#include <bits/stdc++.h>
using namespace std;
const int MAX = 200005;
int a[MAX];
int main() {
  ios::sync_with_stdio(false);
  long long n, s;
  cin >> n >> s;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (int i = 0; i < n; i++) {
    long long l = max(1LL, s - sum + a[i]);
    long long r = min((long long)a[i], s - n + 1);
    cout << max(0LL, l - 1 + a[i] - r) << " ";
  }
  cout << '\n';
  return 0;
}
