#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
inline T LCM(T a, T b) {
  if (a < 0) return LCM(-a, b);
  if (b < 0) return LCM(a, -b);
  return a * (b / gcd(a, b));
}
const int MAXN = 2e5 + 32;
long long int ans[MAXN];
vector<int> num;
int main() {
  memset(ans, 0, sizeof(ans));
  long long int n, sum, total = 0;
  int temp;
  long long needed;
  cin >> n >> sum;
  for (int i = 0; i < n; i++) {
    scanf("%d", &temp);
    num.push_back(temp);
    total = total + 1ll * temp;
    ans[i] = ans[i] + max(0ll, temp - (sum - (n - 1)));
  }
  for (int i = 0; i < n; i++) {
    needed = sum - (total - num[i]);
    if (needed > 0) {
      ans[i] = ans[i] + needed - 1;
    }
    printf("%lld ", ans[i]);
  }
  cout << endl;
  return 0;
}
