#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5, maxm = 1e5 + 5;
const int mod = 1e9 + 7, inf = 0x7f7f7f7f;
long long n, k, b[maxn];
long long a[maxn];
long long calc(long long ai, long long x) { return ai - 3 * x * x + 3 * x - 1; }
long long check(long long d) {
  long long cnt = 0;
  for (int i = 1; i <= n; ++i) {
    long long L = 1, R = a[i];
    while (L < R) {
      int mid = (L + R + 1) >> 1;
      if (calc(a[i], mid) >= d)
        L = mid;
      else
        R = mid - 1;
    }
    cnt += L;
    b[i] = L;
  }
  return cnt;
}
int main() {
  scanf("%lld%lld", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  long long L = -4e18, R = 4e18;
  while (L < R) {
    long long mid = (L + R + 1) >> 1;
    if (check(mid) >= k)
      L = mid;
    else
      R = mid - 1;
  }
  long long s = check(L);
  for (int i = 1; i <= n; ++i) {
    if (s > k && calc(a[i], b[i]) == L) s--, b[i]--;
  }
  for (int i = 1; i <= n; ++i) printf("%lld%c", b[i], i == n ? '\n' : ' ');
  return 0;
}
