#include <bits/stdc++.h>
using namespace std;
long long arr[200000 + 10], n, A, totalsum, res[200000 + 10];
bool check(int x, int i) {
  long long sum = totalsum;
  sum -= arr[i];
  sum += x;
  return sum >= A;
}
bool check2(int x, int i) {
  long long sum = n - 1;
  sum += x;
  return sum <= A;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> A;
  totalsum = 0;
  for (int i = 0; i < (int)n; i++) cin >> arr[i], totalsum += arr[i];
  for (int i = 0; i < (int)n; i++) {
    long long f = 1, l = arr[i] + 1, ans;
    while (f < l) {
      long long mid = (f + l) / 2;
      if (check(mid, i)) {
        l = mid;
        ans = mid;
      } else {
        f = mid + 1;
      }
    }
    res[i] = ans - 1;
  }
  for (int i = 0; i < (int)n; i++) {
    long long f = 1, l = arr[i] + 1, ans;
    while (f < l) {
      long long mid = (f + l) / 2;
      if (check2(mid, i)) {
        f = mid + 1;
        ans = mid;
      } else {
        l = mid;
      }
    }
    res[i] += (arr[i] - ans);
  }
  for (int i = 0; i < (int)n; i++) cout << res[i] << ' ';
  return 0;
}
