#include <bits/stdc++.h>
long long a[100005], b[100005];
int main() {
  long long n, k, i;
  scanf("%lld%lld", &n, &k);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  long long st, dr, mij, last, st2, dr2, mij2, last2, rasp = 0;
  st = -4000000000000000000LL;
  dr = 1000000000;
  while (st <= dr) {
    mij = (st + dr) / 2;
    rasp = 0;
    for (i = 1; i <= n; i++) {
      st2 = 0;
      dr2 = a[i];
      last2 = 0;
      while (st2 <= dr2) {
        mij2 = (st2 + dr2) / 2;
        if (a[i] - 3 * mij2 * mij2 + 3 * mij2 - 1 >= mij)
          last2 = mij2, st2 = mij2 + 1;
        else
          dr2 = mij2 - 1;
      }
      rasp = rasp + last2;
    }
    if (rasp >= k)
      last = mij, st = mij + 1;
    else
      dr = mij - 1;
  }
  rasp = 0;
  for (i = 1; i <= n; i++) {
    st2 = 0;
    dr2 = a[i];
    last2 = 0;
    while (st2 <= dr2) {
      mij2 = (st2 + dr2) / 2;
      if (a[i] - 3 * mij2 * mij2 + 3 * mij2 - 1 >= last)
        last2 = mij2, st2 = mij2 + 1;
      else
        dr2 = mij2 - 1;
    }
    b[i] = last2;
    rasp = rasp + last2;
  }
  for (i = 1; i <= n; i++)
    if (a[i] - 3 * b[i] * b[i] + 3 * b[i] - 1 == last && rasp > k)
      b[i]--, rasp--;
  for (i = 1; i <= n; i++) printf("%lld ", b[i]);
  return 0;
}
