#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, d[200005], ans[200005], i;
  long long A, sum = 0;
  scanf("%I64d %I64d", &n, &A);
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &d[i]);
    sum += d[i];
  }
  for (i = 1; i <= n; i++) {
    long long maxs = min(A - (n - 1), (long long)d[i]);
    long long mins = max((long long)1, A - (sum - d[i]));
    ans[i] = d[i] - (maxs - mins + 1);
  }
  for (i = 1; i <= n; i++) printf("%I64d%c", ans[i], i == n ? '\n' : ' ');
  return 0;
}
