#include <bits/stdc++.h>
using namespace std;
const long long M = 500100;
long long A[M];
int main() {
  long long i, j, k, n, first, sum = 0, a;
  scanf("%I64d%I64d", &n, &first);
  for (i = 0; i < n; i++) scanf("%I64d", &A[i]), sum += A[i];
  for (i = 0; i < n; i++) {
    sum -= A[i];
    a = 0;
    long long temp = first - (n - 1);
    if (temp < A[i]) a = A[i] - temp;
    temp = first - sum;
    if (temp > 0) a += temp - 1;
    printf("%I64d ", a);
    sum += A[i];
  }
  return 0;
}
