#include <bits/stdc++.h>
using namespace std;
long long n, s, sum = 0, ar[200000], i, m = 0;
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    sum += ar[i];
  }
  for (int i = 0; i < n; i++)
    cout << max(s - sum + ar[i] - 1, 1LL * 0) + max(ar[i] - s + n - 1, 1LL * 0)
         << " ";
}
