#include <bits/stdc++.h>
using namespace std;
long long nxt() {
  long long x;
  cin >> x;
  return x;
}
long long n, k;
vector<long long> a, b;
long long getsm(long long dmax) {
  long long sm = 0;
  for (long long i = 0; i < n; ++i) {
    long long l = 1, r = a[i] + 1;
    while (l < r) {
      long long m = (l + r) / 2;
      long long d = a[i] - 3 * m * m + 3 * m - 1;
      if (dmax > d)
        r = m;
      else
        l = m + 1;
    }
    l = min(l, a[i]);
    b[i] = l;
    sm += l;
  }
  return sm;
}
void solve(long long test_number) {
  n = nxt(), k = nxt();
  a.resize(n);
  b.resize(n);
  generate((a).begin(), (a).end(), nxt);
  if (k <= n) {
    for (long long i = 0; i < n; ++i) cout << (k-- > 0 ? 1 : 0) << " ";
    cout << endl;
    return;
  }
  long long l = -4e18, r = 4e18, sm;
  while (l < r) {
    long long m = l + (r - l) / 2;
    sm = getsm(m);
    if (sm >= k)
      l = m + 1;
    else if (sm < k)
      r = m;
  }
  sm = getsm(l);
  vector<long long> resize(b);
  getsm(l - (1 + (l == 1)));
  for (long long i = 0; i < n; ++i)
    if (sm < k && resize[i] + 1 == b[i]) {
      ++sm;
      ++resize[i];
    }
  for (long long i = 0; i < n; ++i) cout << resize[i] << " ";
  cout << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  long long t = 1;
  for (long long i = 0; i < t; ++i) {
    solve(i);
  }
}
