#include <bits/stdc++.h>
using namespace std;
const long long int N1 = 1000010;
const long long int N2 = 2000010;
const long long int mod1 = 1e2 + 7;
const long long int mod2 = 1e9 + 7;
const int N = 1e6 + 6;
long long int arr[N];
int main() {
  long long int n, A;
  cin >> n >> A;
  ;
  long long int sm = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    ;
    sm += arr[i];
  }
  for (int i = 1; i <= n; i++) {
    if (i > 1) cout << " ";
    long long int tmp =
        arr[i] - min(arr[i], A - n + 1) + max(1LL, A - (sm - arr[i])) - 1;
    cout << tmp;
  }
  cout << "\n";
  return 0;
}
