#include <bits/stdc++.h>
using namespace std;
const long long int MAXN = 2e5 + 51, inf = 1e18;
long long int n, kk, l, r, mid, sm;
long long int u[MAXN], v[MAXN];
inline long long int read() {
  register long long int num = 0, neg = 1;
  register char ch = getchar();
  while (!isdigit(ch) && ch != '-') {
    ch = getchar();
  }
  if (ch == '-') {
    neg = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    num = (num << 3) + (num << 1) + (ch - '0');
    ch = getchar();
  }
  return num * neg;
}
inline long long int f(long long int u, long long int x) {
  return u == x ? inf : u - 3 * x * x + 3 * x - 1;
}
inline long long int calc(long long int x, long long int lim) {
  long long int l = 1, r = u[x], mid, res = u[x];
  while (l < r) {
    mid = (l + r) >> 1;
    f(u[x], mid) <= lim ? r = mid : l = mid + 1;
  }
  return l;
}
inline long long int check(long long int mid) {
  sm = 0;
  for (register int i = 1; i <= n; i++) {
    sm += (v[i] = calc(i, mid));
  }
  return sm <= kk;
}
int main() {
  n = read(), kk = read();
  for (register int i = 1; i <= n; i++) {
    u[i] = read(), l = min(l, f(u[i], u[i] - 1)), r = max(r, f(u[i], 0));
  }
  long long int ans = 0;
  l--;
  while (l < r) {
    mid = (l + r) >> 1;
    check(mid) ? (r = mid) : l = mid + 1;
  }
  check(l), kk -= sm;
  for (register int i = 1; i <= n; i++) {
    kk &&v[i] < u[i] && f(u[i], v[i]) == l ? v[i]++, kk-- : 1;
  }
  for (register int i = 1; i <= n; i++) {
    printf("%lld ", v[i]);
  }
}
