#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e, i, j, ii, jj, zx, xc, k, lef, rig, mid, f[100009], lf,
    rg, md, ee;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> a >> k;
  for (i = 1; i <= a; i++) cin >> f[i];
  lef = -9000000000000000100LL;
  rig = 2000000000LL;
  while (1) {
    if (lef + 1 >= rig) break;
    mid = (lef + rig) / 2;
    e = 0;
    ee = 0;
    for (i = 1; i <= a; i++) {
      lf = -1;
      rg = f[i];
      while (1) {
        if (lf + 1 >= rg) break;
        md = (lf + rg) / 2;
        if (f[i] - 3 * md * md - 3 * md - 1 >= mid) {
          lf = md;
        } else {
          rg = md;
        }
      }
      e += lf + 1;
      if (lf != -1 && f[i] - 3 * lf * lf - 3 * lf - 1 == mid) {
        ee++;
      }
    }
    if (e >= k && e - ee <= k) {
      ee = e - k;
      for (i = 1; i <= a; i++) {
        lf = -1;
        rg = f[i];
        while (1) {
          if (lf + 1 >= rg) break;
          md = (lf + rg) / 2;
          if (f[i] - 3 * md * md - 3 * md - 1 >= mid) {
            lf = md;
          } else {
            rg = md;
          }
        }
        long long E = lf + 1;
        if (lf != -1 && f[i] - 3 * lf * lf - 3 * lf - 1 == mid && ee > 0) {
          ee--;
          E--;
        }
        cout << E << " ";
      }
      return 0;
    }
    if (e < k) {
      rig = mid;
    } else {
      lef = mid;
    }
  }
  return 0;
}
