#include <bits/stdc++.h>
#pragma GCC optimize( \
    "Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math")
using namespace std;
const int N = 2e5 + 5, M = 2 * N + 5;
int n, a[N];
long long sum, tot;
int main() {
  scanf("%d %lld", &n, &tot);
  for (int i = 0; i < n; ++i) scanf("%d", a + i), sum += a[i];
  for (int i = 0; i < n; ++i)
    printf("%lld ", max(0ll, tot - (sum - a[i]) - 1) +
                        max(0ll, 1ll * a[i] - tot + n - 1));
  puts("");
}
