#include <bits/stdc++.h>
using namespace std;
std::mt19937 rnd(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 100000;
const int MAXA = 1000000000;
const long long MAXDELTAVAL = MAXA;
const long long MINDELTAVAL =
    -((long long)3 * MAXA * MAXA - (long long)3 * MAXA + 1);
int n;
long long want;
int a[MAXN];
int b[MAXN];
pair<int, int> o[MAXN];
int res[MAXN];
long long cost(long long x) { return -(3 * x * x - 3 * x + 1); }
long long calc(long long delta) {
  long long lo = 0, hi = MAXA + 1;
  while (lo + 1 < hi) {
    long long mi = lo + (hi - lo) / 2;
    if (cost(mi) >= delta)
      lo = mi;
    else
      hi = mi;
  }
  long long x = lo;
  long long ret = 0;
  for (int i = (0); i < (n); ++i) {
    while (o[i].first + cost(x + 1) >= delta) ++x;
    res[o[i].second] = min(x, (long long)o[i].first);
    ret += res[o[i].second];
  }
  return ret;
}
void solve() {
  for (int i = (0); i < (n); ++i) o[i] = make_pair(a[i], i);
  sort(o, o + n);
  long long lo = MINDELTAVAL - 1, hi = MAXDELTAVAL + 1;
  while (lo + 1 < hi) {
    long long mi = lo + (hi - lo) / 2;
    long long have = calc(mi);
    if (have <= want)
      hi = mi;
    else
      lo = mi;
  }
  long long delta = hi;
  long long sofar = calc(delta);
  assert(sofar <= want);
  for (int i = (0); i < (n); ++i) b[i] = res[i];
  if (sofar < want) {
    long long toomuch = calc(delta - 1);
    assert(toomuch > want);
    long long rem = want - sofar;
    for (int i = (0); i < (n); ++i)
      if (res[i] > b[i] && rem > 0) ++b[i], --rem;
    assert(rem == 0);
  }
}
void run() {
  scanf("%d%lld", &n, &want);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  solve();
  for (int i = (0); i < (n); ++i) {
    if (i != 0) printf(" ");
    printf("%d", b[i]);
  }
  puts("");
}
int main() {
  run();
  return 0;
}
