#include <bits/stdc++.h>
using namespace std;
long long f(long long a, long long b) {
  if (b == a) return -9e18;
  return a - 3 * b * b - 3 * b - 1;
}
const int DEBUG = 0;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  long long n = 1e5, k = 1e13;
  if (!DEBUG) cin >> n >> k;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    if (!DEBUG)
      cin >> a[i];
    else
      a[i] = rand() % 1000000000 + 1;
  }
  long double l = -3e18, r = a[0];
  for (int it = 0; it < 100 && r - l > 1e-8; ++it) {
    long double t = (l + r) / 2;
    double s = 0;
    for (int i = 0; i < n; ++i) {
      s += min(1. * a[i], sqrt(max(0., a[i] - (double)t) / 3.));
    }
    if (s >= k) {
      l = t;
    } else {
      r = t;
    }
  }
  vector<long long> b(n);
  long long rem = k;
  vector<pair<long long, long long> > ts(n);
  for (int i = 0; i < n; ++i) {
    b[i] = sqrtl(max((long double)0., a[i] - r) / 3.);
    b[i] = min(b[i], a[i]);
    rem -= b[i];
    ts[i] = pair<long long, long long>(f(a[i], b[i]), i);
  }
  assert(rem >= 0 && rem <= n);
  sort(ts.rbegin(), ts.rend());
  for (int i = 0; i < rem; ++i) b[ts[i].second]++;
  for (int i = 0; i < n; ++i) cout << b[i] << ' ';
  cout << endl;
  return 0;
}
