#include <bits/stdc++.h>
using namespace std;
int n;
long long k, a[100005], b[100005];
long long calc(long long d) {
  long long res = 0ll;
  for (int i = 0; i < n; i++) {
    if (d > a[i]) {
      b[i] = 0;
      continue;
    }
    long long x = max((long long)(sqrt((long double)(a[i] - d) / 3.0)), 0ll);
    if (a[i] - 3ll * x * x > d) x++;
    x = min(x, a[i]);
    b[i] = x;
    res += x;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long lf = -3e18, rg = 1e9, md;
  while (rg - lf > 1) {
    md = (lf + rg) / 2;
    if (calc(md) <= k)
      rg = md;
    else
      lf = md;
  }
  long long ans = calc(rg);
  for (int i = 0; i < n && ans < k; i++) {
    if (a[i] == b[i]) continue;
    if (a[i] - 3ll * b[i] * b[i] == rg) {
      b[i]++;
      ans++;
    }
  }
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << endl;
  return 0;
}
