#include <bits/stdc++.h>
using namespace std;
long long A, val[200005], sum;
int n;
int main() {
  cin >> n >> A;
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &val[i]);
    sum += val[i];
  }
  for (int i = 0; i < n; i++) {
    long long x =
        max(0LL, A - sum + val[i] - 1) + val[i] - min(val[i], A - n + 1);
    x = min(x, val[i]);
    cout << x << " ";
  }
  return 0;
}
