#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long sum = 0, f = 1;
  char ch = getchar();
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') ch = getchar(), f = -1;
  while (ch <= '9' && ch >= '0') sum = sum * 10 + ch - '0', ch = getchar();
  return sum * f;
}
long long n, k;
long long a[200010];
long long suan(long long id, long long b) {
  return a[id] - (3ll * b * b - 3ll * b + 1);
}
long long ans[200010];
signed main() {
  n = read(), k = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  long long l = -4e18, r = 4e18;
  long long A;
  while (l <= r) {
    long long mid = l + r >> 1;
    long long sum = 0;
    for (long long i = 1; i <= n; i++) {
      long long L = 1, R = a[i];
      long long ss = 0;
      while (L <= R) {
        long long mi = L + R >> 1;
        if (suan(i, mi) >= mid)
          ss = mi, L = mi + 1;
        else
          R = mi - 1;
      }
      sum += ss;
    }
    if (sum >= k)
      A = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  for (long long i = 1; i <= n; i++) {
    long long L = 1, R = a[i];
    long long ss = 0;
    while (L <= R) {
      long long mid = L + R >> 1;
      if (suan(i, mid) >= A)
        ss = mid, L = mid + 1;
      else
        R = mid - 1;
    }
    ans[i] = ss;
    k -= ss;
  }
  for (long long i = 1; i <= n; i++) {
    if (k < 0 && suan(i, ans[i]) == A) ans[i]--, k++;
  }
  for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
