#include <bits/stdc++.h>
using namespace std;
long long sum, n, a[200005], k, b[200005];
double f(long long a, long long x) { return a - 3.0 * x * x + 3.0 * x - 1.0; }
int judge(long long delta) {
  sum = 0;
  for (int i = 1; i <= n; i++) {
    long long L = 0, R = a[i], mid;
    b[i] = 0;
    while (L <= R) {
      mid = L + R >> 1;
      if (f(a[i], mid) >= delta)
        b[i] = mid, L = mid + 1;
      else
        R = mid - 1;
    }
  }
  for (int i = 1; i <= n; i++) sum += b[i];
  if (sum <= k) return 1;
  return 0;
}
struct Node {
  long long id, v, up;
} p[200005];
int cmp1(Node a, Node b) { return a.up > b.up; }
int cmp2(Node a, Node b) { return a.id < b.id; }
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long L = -4e18, R = 1e18, mid, ans;
  while (L <= R) {
    mid = L + R >> 1;
    if (judge(mid))
      ans = mid, R = mid - 1;
    else
      L = mid + 1;
  }
  judge(ans);
  if (sum == k) {
    for (int i = 1; i <= n; i++) cout << b[i] << " ";
  } else if (sum < k) {
    for (int i = 1; i <= n; i++)
      p[i].id = i, p[i].v = b[i], p[i].up = f(a[i], b[i] + 1);
    sort(p + 1, p + 1 + n, cmp1);
    for (int i = 1; i <= n; i++)
      if (p[i].v < a[p[i].id]) {
        p[i].v++;
        if (++sum == k) break;
      }
    sort(p + 1, p + 1 + n, cmp2);
    for (int i = 1; i <= n; i++) cout << p[i].v << ' ';
  }
}
