#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto v : vec) os << v << ",";
  os << "]";
  return os;
}
__int128 eval(lint a, __int128 x) { return x * (a - x * x); }
__int128 differential(lint a, __int128 x) {
  if (x <= 0) return 1e12;
  return eval(a, x) - eval(a, x - 1);
}
int argmaxf(lint a) {
  lint bcand = sqrt(a / 3 + 1);
  __int128 ret = bcand;
  for (int b = (max<lint>(bcand - 10, 0)),
           b_end_ = (min<lint>(a + 1, bcand + 10));
       b < b_end_; b++) {
    __int128 bi = b;
    if (bi * (a - bi * bi) >= ret * (a - ret * ret)) ret = bi;
  }
  return ret;
}
int main() {
  int N;
  lint K;
  cin >> N >> K;
  vector<lint> A(N);
  cin >> A;
  vector<lint> amaxb(N);
  for (int i = (0), i_end_ = (N); i < i_end_; i++) amaxb[i] = argmaxf(A[i]);
  lint tot = accumulate(amaxb.begin(), amaxb.end(), 0LL);
  vector<lint> use_tmp(N);
  vector<int> just(N);
  lint nb_use = -1;
  vector<lint> lo;
  vector<lint> hi;
  vector<lint> cr(N);
  auto binary = [&](__int128 c) -> void {
    nb_use = 0;
    for (int i = (0), i_end_ = (N); i < i_end_; i++) {
      lint l = lo[i], r = hi[i];
      while (r > l + 1) {
        lint x = (l + r) / 2;
        __int128 d = differential(A[i], x);
        (d >= c ? l : r) = x;
      }
      __int128 d = differential(A[i], l);
      cr[i] = l;
      nb_use += l;
      just[i] = (d == c);
    }
  };
  __int128 vok, vng;
  if (tot >= K) {
    lo.assign(N, 0);
    hi = amaxb;
    for (auto &x : hi) x++;
    vok = 0, vng = 1e19;
  } else {
    lo = amaxb;
    hi = A;
    for (auto &x : hi) x++;
    vok = -3.1e27, vng = 1;
  }
  while (vng - vok > 1) {
    lint c = (vok + vng) / 2;
    binary(c);
    if (nb_use >= K) {
      vok = c;
      hi = cr;
      for (auto &x : hi) x++;
    } else {
      vng = c;
      lo = cr;
    }
  }
  binary(vok);
  for (int i = (0), i_end_ = (N); i < i_end_; i++)
    if (nb_use > K and just[i]) cr[i]--, nb_use--;
  for (auto x : cr) {
    cout << x << ' ';
  }
  cout << '\n';
}
