#include <bits/stdc++.h>
using namespace std;
int n;
long long g;
vector<int> a;
int solveC() {
  cin >> n >> g;
  a.resize(n);
  long long sum = 0;
  for (auto &x : a) {
    scanf("%d", &x);
    sum += (long long)x;
  }
  for (auto x : a) {
    long long x1 = (long long)(g - (long long)(sum - (long long)x));
    long long x2 = (g - (long long)(n - 1));
    x1 = x1 > 0LL ? x1 : 1LL;
    x2 = x2 > 0LL ? x2 : 1LL;
    x1 = x1 > x ? x : x1;
    x2 = x2 > x ? x : x2;
    long long ans = x1 - 1LL + (x - x2);
    ans = ans > 0LL ? ans : 0LL;
    ans = ans <= x ? ans : x;
    cout << ans << " ";
  }
  cout << endl;
  return 0;
}
int main() { solveC(); }
