#include <bits/stdc++.h>
using namespace std;
const int N = 1E5 + 10;
const long long INF = 4E18;
int n;
long long k, a[N], b[N];
long long check(double m) {
  for (int i = 0; i < n; i++)
    if (a[i] - m - 1 <= 0)
      b[i] = 0;
    else
      b[i] = min(a[i], (long long)(sqrt((a[i] - m - 1) / 3)));
  long long res = 0;
  for (int i = 0; i < n; i++) res += b[i];
  return res;
}
long long f(long long b, long long xb) { return a[xb] - 1 - 3 * b * b + 3 * b; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long l = -INF, r = INF;
  while (r - l > 1) {
    long long mid = (l + r) >> 1;
    if (check(mid) <= k)
      r = mid;
    else
      l = mid + 1;
  }
  check(r);
  for (int i = 0; i < n; i++) k -= b[i];
  priority_queue<pair<long long, int> > que;
  for (int i = 0; i < n; i++)
    if (b[i] < a[i]) que.push(pair<long long, int>(f(b[i] + 1, i), i));
  while (k--) {
    pair<long long, int> p = que.top();
    que.pop();
    b[p.second]++;
    if (b[p.second] < a[p.second])
      que.push(pair<long long, int>(f(b[p.second] + 1, p.second), p.second));
  }
  for (int i = 0; i < n; i++) cout << b[i] << ' ';
}
