#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long res = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (isdigit(ch)) {
    res = (res << 3) + (res << 1) + ch - '0';
    ch = getchar();
  }
  return res * f;
}
namespace qiqi {
const int N = 1e5 + 5;
const double eps = 1e-8;
int n;
long long a[N], b[N];
long long k;
inline long long f(long long a, int b) { return 1ll * a * b - 1ll * b * b * b; }
inline long long check(long long d) {
  long long res = 0, x;
  for (int i = (1); i <= (n); ++i) {
    x = min((long long)sqrt((a[i] + d) / 3), a[i]);
    res += b[i] =
        x == a[i] ? x : (f(a[i] + d, x) < f(a[i] + d, x + 1) ? x + 1 : x);
  }
  return res;
}
void main() {
  long long l = -4e18, r = 4e18, mid;
  n = read();
  k = read();
  for (int i = (1); i <= (n); ++i) a[i] = read();
  while (l <= r) {
    check(mid = l + ((r - l) >> 1)) <= k ? l = mid + 1 : r = mid - 1;
  }
  k -= check(r);
  for (int i = (1); i <= (n); ++i)
    while (k && f(a[i], b[i]) == f(a[i], b[i] + 1) + r && b[i] < a[i]) {
      ++b[i];
      --k;
    }
  for (int i = (1); i <= (n); ++i) printf("%lld ", b[i]);
}
}  // namespace qiqi
int main() {
  qiqi::main();
  return 0;
}
