#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001;
long long A[MX], B[MX];
int N;
long long ex(long long X, long long Y) {
  if (Y == 0) return 5e18;
  Y--;
  return X - 1 - 3 * Y - 3 * Y * Y;
}
long long getCnt(long long X, long long cap) {
  long long lo = 0, hi = X;
  while (lo < hi) {
    long long mid = (lo + hi + 1) / 2;
    if (ex(X, mid) >= cap) {
      lo = mid;
    } else {
      hi = mid - 1;
    }
  }
  return lo;
}
long long total(long long cap) {
  long long ans = 0;
  for (int i = 0; i < (N); i++) {
    B[i] = getCnt(A[i], cap);
    ans += B[i];
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  long long K;
  cin >> K;
  for (int i = 0; i < (N); i++) cin >> A[i];
  long long lo = -4e18, hi = 4e18;
  while (lo < hi) {
    long long mid = lo + (hi - lo) / 2;
    if (total(mid) <= K) {
      hi = mid;
    } else {
      lo = mid + 1;
    }
  }
  long long cnt = total(lo);
  for (int i = 0; i < (N); i++) {
    long long poss = getCnt(A[i], lo - 1);
    long long old = B[i];
    B[i] = min(poss, old + K - cnt);
    cnt += B[i] - old;
  }
  for (int i = 0; i < (N); i++) {
    cout << B[i] << " ";
  }
  cout << nl;
  return 0;
}
