#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int N = 200005;
int n;
long long mn, mx, a[N], sum = 0, A;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n >> A;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mn += 1;
    mx += a[i];
  }
  for (int i = 0; i < n; i++) {
    mx -= a[i];
    long long first = max(1ll, A - mx);
    long long second = min(a[i], A - n + 1);
    cout << a[i] - (second - first + 1) << " ";
    mx += a[i];
  }
}
