#include <bits/stdc++.h>
using namespace std;
void pr(__int128 x) {
  if (x < 0) putchar('-'), x = -x;
  if (x < 10) return putchar('0' + x), void();
  pr(x / 10), putchar('0' + (x % 10));
}
int n;
long long k;
int a[300005], b[300005];
long long nx[300005];
__int128 f(__int128 c, __int128 x) { return x * (c - x * x); }
__int128 g(__int128 c, __int128 x) {
  return x == c ? -0x3f3f3f3f3f3f3f3f : f(c, x + 1) - f(c, x);
}
inline __int128 calc(__int128 c, int tp = 0) {
  __int128 num = 0;
  for (int i = 1; i <= (n); ++i) {
    __int128 t = a[i] + c;
    __int128 x = sqrt((long double)t / 3);
    if (x > a[i]) x = a[i];
    if (x < 0) x = 0;
    while (x < a[i] && f(t, x + 1) > f(t, x)) ++x;
    while (x > 0 && f(t, x - 1) >= f(t, x)) --x;
    num += x;
    if (tp) b[i] = x;
  }
  return num;
}
priority_queue<pair<long long, int> > pq;
int main() {
  scanf("%d%lld", &n, &k);
  for (int i = 1; i <= (n); ++i) scanf("%d", a + i);
  __int128 l = -1.1e9, r = 3.1e18, mid, ans = l;
  while (l <= r) {
    mid = (l + r) / 2;
    __int128 num = calc(mid);
    if (num <= k)
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  long long num = calc(ans, 1);
  for (int i = 1; i <= (n); ++i) pq.push({g(a[i], b[i]), i});
  while (num < k) {
    pair<long long, int> x = pq.top();
    pq.pop();
    ++num;
    pq.push({g(a[x.second], ++b[x.second]), x.second});
  }
  for (int i = 1; i <= (n); ++i) printf("%d%c", b[i], " \n"[i == n]);
  return 0;
}
