#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n, k;
  cin >> n >> k;
  vector<int> A(n);
  for (auto &a : A) cin >> a;
  vector<int> B(n);
  auto calc = [&](ll d) {
    ll sum = 0;
    for (int i = 0; i < n; i++) {
      if (d > A[i]) {
        B[i] = 0;
        continue;
      }
      ll x = max((ll)sqrt(double(A[i] - d) / 3), 0ll);
      if ((ll)A[i] - 3ll * x * x > d) ++x;
      x = min(x, (ll)A[i]);
      B[i] = x;
      sum += x;
    }
    return sum;
  };
  ll difl = -3e18 - 1, difh = *max_element(A.begin(), A.end());
  while (difh - difl > 1) {
    auto d = (difl + difh) / 2;
    if (calc(d) <= k) {
      difh = d;
    } else {
      difl = d;
    }
  }
  auto sum = calc(difh);
  for (int i = 0; i < n and sum < k; i++) {
    if (B[i] == A[i]) continue;
    if ((ll)A[i] - 3ll * B[i] * B[i] == difh) {
      B[i]++;
      sum++;
    }
  }
  for (auto b : B) cout << b << " ";
  cout << endl;
  return 0;
}
