#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
#pragma optimize("fast-math")
using namespace std;
const int mxn = 1e5 + 1;
long long arr[mxn], ans[mxn];
int n;
long long k;
long long check(long long delta) {
  long long sm = 0;
  for (int i = 0; i < n; i++) {
    long long l = 0, r = arr[i] + 1;
    while (r - l > 1) {
      long long m = (r + l) / 2;
      if (arr[i] - 3ll * m * (m + 1) - 1 >= delta)
        l = m;
      else
        r = m;
    }
    ans[i] = l;
    sm += l;
  }
  return sm;
}
void solve() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  long long l = -4e18, r = 4e18;
  while (r - l > 1) {
    long long mm = l + ((r - l) >> 1);
    if (check(mm) >= k)
      l = mm;
    else
      r = mm;
  }
  long long kek = check(l);
  for (int i = 0; i < n; i++) {
    if (kek > k && ans[i] > 0 &&
        arr[i] - 3ll * (ans[i]) * (ans[i] + 1) - 1 == l) {
      kek--;
      ans[i]--;
    }
    cout << ans[i] << " ";
  }
}
void testcases(int n) {
  n = 1 - n;
  if (!n) cin >> n;
  for (int i = 0; i < n; i++) {
    solve();
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  unsigned int beg_time = clock();
  testcases(0);
  unsigned int end_time = clock();
  return 0;
}
