#include <bits/stdc++.h>
using namespace std;
vector<long long> projects;
long long n, k;
long long getnumbelow(long long i, long long x) {
  long long l = 0, r = projects[i] - 1;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (projects[i] - 3 * mid * mid - 3 * mid - 1 >= x) {
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  return l;
}
long long num(long long delta) {
  long long tot = 0;
  for (int i = 0; i < n; i++) {
    tot += getnumbelow(i, delta);
  }
  return tot;
}
void findanswer(long long delta) {
  long long numfind = k - num(delta + 1);
  long long tot = 0;
  for (int i = 0; i < n; i++) {
    long long val = getnumbelow(i, delta);
    long long low = getnumbelow(i, delta + 1);
    if (numfind > 0) {
      long long take = min(numfind, max(0LL, min(projects[i], val) - low));
      numfind -= take;
      low += take;
    }
    cout << low << " ";
  }
  cout << '\n';
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  projects.resize(n);
  long long maxdelta = 0;
  for (int i = 0; i < n; i++) {
    cin >> projects[i];
    maxdelta = max(maxdelta, projects[i]);
  }
  long long l = -3 * maxdelta * maxdelta - 2 * maxdelta - 1, r = maxdelta;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (num(mid) <= k) {
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  l--;
  findanswer(l);
  return 0;
}
