#include <bits/stdc++.h>
using namespace std;
vector<int> dice;
int main() {
  int n, cur_ans;
  long long A, r_s = 0;
  cin >> n >> A;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    dice.push_back(temp);
    r_s += temp;
  }
  for (int i = 0; i < n; i++) {
    cur_ans = 0;
    if (A - (r_s - dice[i]) - 1 > 0) {
      cur_ans += A - (r_s - dice[i]) - 1;
    }
    if (dice[i] - (A - (n - 1)) > 0) {
      cur_ans += dice[i] - (A - (n - 1));
    }
    if (cur_ans > dice[i]) {
      cur_ans = dice[i];
    }
    cout << cur_ans << " ";
  }
}
