#include <bits/stdc++.h>
using namespace std;
template <typename Tp>
void read(Tp &x) {
  x = 0;
  long long fh = 1;
  char ch = 1;
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') fh = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= fh;
}
template <typename Tp>
void biread(Tp &x) {
  x = 0;
  long long fh = 1;
  char ch = 1;
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') fh = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 2 + ch - '0', ch = getchar();
  x *= fh;
}
const long long maxn = 100000 + 7;
long long n, k;
long long a[maxn], b[maxn];
priority_queue<pair<long long, long long> > Q;
long long mx;
void Init(void) {
  read(n);
  read(k);
  for (long long i = 1; i <= n; i++) read(a[i]), mx = max(mx, a[i]);
}
long long cnt;
long long check(long long p) {
  long long curr = 0;
  for (long long i = 1; i <= n; i++) {
    long long L = 0, R = a[i];
    while (L < R) {
      long long mid = (L + R + 1) >> 1;
      if (a[i] - 3 * mid * mid + 3 * mid - 1 >= p)
        L = mid;
      else
        R = mid - 1;
    }
    b[i] = L;
    curr += L;
  }
  return curr;
}
void Work(void) {
  long long L = mx * (-3) * mx + 4 * mx - 1, R = mx;
  while (L < R) {
    long long mid = (L + R + 1) >> 1;
    if (check(mid) >= k)
      L = mid;
    else
      R = mid - 1;
  }
  long long ans = check(L) - k;
  for (long long i = 1; i <= n && ans > 0; i++) {
    if (L == a[i] - b[i] * b[i] * 3 + b[i] * 3 - 1) --b[i], --ans;
  }
  for (long long i = 1; i <= n; i++) {
    printf("%lld%c", b[i], " \n"[i == n]);
  }
}
signed main(void) {
  Init();
  Work();
  return 0;
}
