#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")
#pragma GCC target("avx2")
using namespace std;
template <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
const long long MOD2 = (long long)998244353 * (long long)998244353;
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 998244353) {
  x += y;
  if (x >= mod) x -= mod;
  if (x < 0) x += mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 998244353) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
int a[100035], b[100035];
long long cal(int i, long long x) { return -3LL * x * x + 3 * x - 1 + a[i]; }
long long ck(long long mid) {
  long long ans = 0;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    long long l = 1, r = a[i];
    while (l <= r) {
      long long mm = (l + r) / 2;
      if (cal(i, mm) >= mid)
        l = mm + 1;
      else
        r = mm - 1;
    }
    b[i] = r;
    ans += r;
  }
  return ans;
}
void fmain(int tid) {
  scanf("%d%lld", &n, &lk);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", a + i);
  long long l = -3e18, r = 2e9;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (ck(mid) >= lk)
      l = mid + 1;
    else
      r = mid - 1;
  }
  long long ans = ck(r) - lk;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    int z = b[i];
    if (ans > 0 && cal(i, z) == r) {
      z--;
      ans--;
    }
    printf("%d ", z);
  }
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
