#include <bits/stdc++.h>
using namespace std;
void may_answer(vector<int> &dice, long long max_sum, long long sum, int i,
                int n) {
  long long at_least = sum - (max_sum - dice[i]);
  long long at_most = sum - (n - 1);
  int answer = 0;
  if (at_least >= 1) answer += at_least - 1;
  if (at_most <= dice[i]) answer += dice[i] - at_most;
  dice[i] = answer;
}
int main() {
  long long n, sum;
  cin >> n >> sum;
  vector<int> dice;
  dice.assign(n, 0);
  long long max_sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> dice[i];
    max_sum += dice[i];
  }
  for (int i = 0; i < n; i++) may_answer(dice, max_sum, sum, i, n);
  for (int i = 0; i < n; i++) cout << dice[i] << " ";
  cout << endl;
  return 0;
}
