#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-5;
const int INF = 1 << 30, mod = 1e9, N = 1e6 + 6;
long long n, A;
long long sum = 0;
int a[N];
int main() {
  cin >> n >> A;
  for (int(i) = int(1); i <= int(n); i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (int(i) = int(1); i <= int(n); i++) {
    int l = max(A + a[i] - sum, 1LL);
    int r = min(0LL + a[i], A + 1 - n);
    int k = a[i] - (r - l + 1);
    cout << k << " ";
  }
}
