#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    qp;
vector<long long> ns;
long long solve(long long Y, int i) {
  if (v[i] - 1ll <= Y) return 0;
  long long ini = 1, fin = v[i];
  while (ini < fin - 1) {
    long long piv = (ini + fin) >> 1ll;
    if (v[i] - 3ll * piv * piv - 3ll * piv - 1ll >= Y)
      ini = piv;
    else
      fin = piv - 1ll;
  }
  long long piv = fin;
  if (v[i] - 3ll * piv * piv - 3ll * piv - 1ll >= Y) return fin;
  return ini;
}
long long check(long long X) {
  long long acc = 0;
  for (int i = 0; i < v.size(); i++) acc += solve(X, i);
  return acc;
}
int main() {
  long long n, k;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  long long a;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    v.push_back(a);
  }
  long long ini = -1ll << 62, fin = 1ll << 62;
  while (ini < fin - 1ll) {
    long long piv = (ini + fin) >> 1;
    if (check(piv) >= k)
      ini = piv;
    else
      fin = piv - 1ll;
  }
  long long tot = check(ini);
  for (int i = 0; i < n; i++) {
    long long piv = solve(ini, i);
    ns.push_back(piv);
    if (!piv) continue;
    long long z = v[i] - piv * (3ll * piv - 3ll) - 1ll;
    qp.push({z, i});
  }
  for (int i = 1; i <= tot - k; i++) {
    long long node = qp.top().second;
    qp.pop();
    if (!ns[node]) continue;
    ns[node]--;
    long long piv = ns[node];
    long long z = v[i] - piv * (3ll * piv - 3ll) - 1ll;
    qp.push({z, node});
  }
  for (auto i : ns) cout << i << ' ';
  return 0;
}
