#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long inf_ll = 1e18;
const long long N = 1e5 + 5;
long long n, k;
long long a[N], p[N], b[N], c[N];
long long qry(long long i, long long x) { return x * (a[i] - x * x); }
long long ch(long long d) {
  long long r = 0;
  for (long long i = 0; i < n; i++) {
    long long x, y;
    if (k >= 0)
      x = 0, y = a[i] - p[i];
    else
      x = 0, y = p[i];
    while (x < y) {
      long long m = (x + y) / 2;
      if (qry(i, p[i] + max(0ll, m - 1) * (k >= 0 ? 1ll : -1ll)) -
              qry(i, p[i] + m * (k >= 0 ? 1ll : -1ll)) <
          d)
        x = m + 1;
      else
        y = m;
    }
    b[i] = p[i] + x * (k >= 0 ? 1ll : -1ll), r += x;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    p[i] = round(sqrt(double(a[i]) / 3));
    if (qry(i, p[i]) < qry(i, p[i] + 1)) p[i]++;
    if (qry(i, p[i]) < qry(i, p[i] - 1)) p[i]--;
    p[i] = max(0ll, min(p[i], a[i]));
    k -= p[i];
  }
  long long x = 0, y = 4e18;
  while (x < y) {
    long long m = (x + y) / 2;
    if (ch(m) < abs(k))
      x = m + 1;
    else
      y = m;
  }
  ch(x);
  if (k != 0) {
    if (ch(x) != abs(k)) {
      for (long long i = 0; i < n; i++) c[i] = b[i];
      long long r = abs(k) - ch(x - 1);
      for (long long i = 0; i < n; i++) {
        if (r == 0) break;
        if (c[i] != b[i]) b[i] = c[i], r--;
      }
    }
  }
  for (long long i = 0; i < n; i++) cout << b[i] << " \n"[i == n - 1];
}
