#include <bits/stdc++.h>
using namespace std;
int main() {
  long long b[200005], i, j, n, m, k1, k2, k, a, sum = 0;
  cin >> n >> a;
  for (i = 0; i < n; i++) {
    cin >> b[i];
    sum += b[i];
  }
  for (i = 0; i < n; i++) {
    k2 = a - n + 1;
    k1 = a - (sum - b[i]);
    k = min(b[i], k2) - max(k1, n / n) + 1;
    cout << b[i] - k << " ";
  }
  return 0;
}
