#include <bits/stdc++.h>
using namespace std;
long long k, n, a[1100100];
bool check(long long x) {
  long long sum = 0;
  for (long long i = 1; i <= n; i++) {
    long long l = -1, r = a[i];
    while (l + 1 < r) {
      long long mid = (l + r) / 2;
      if (a[i] - 3 * mid * mid - 3 * mid + 1 >= x)
        l = mid;
      else
        r = mid - 1;
    }
    long long cnt = (a[i] - 3 * r * r - 3 * r + 1 >= x) ? r + 1 : l + 1;
    sum += min(cnt, a[i]);
  }
  return sum >= k;
}
struct node {
  long long data, num;
};
long long cnt[1100000];
priority_queue<node> q;
bool operator<(node a, node b) { return a.data > b.data; }
void out(long long x) {
  long long sum = 0;
  for (long long i = 1; i <= n; i++) {
    long long l = -1, r = a[i];
    while (l + 1 < r) {
      long long mid = (l + r) / 2;
      if (a[i] - 3 * mid * mid - 3 * mid + 1 >= x)
        l = mid;
      else
        r = mid - 1;
    }
    cnt[i] = (a[i] - 3 * r * r - 3 * r + 1 >= x) ? r + 1 : l + 1;
    cnt[i] = min(cnt[i], a[i]);
    sum += cnt[i];
  }
  long long d = sum - k;
  for (long long i = 1; i <= n; i++)
    if (cnt[i] != 0) {
      long long cc = cnt[i] - 1;
      q.push({a[i] - 3 * cc * cc - 3 * cc + 1, i});
    }
  for (long long i = 1; i <= d; i++) {
    node t = q.top();
    q.pop();
    cnt[t.num]--;
  }
  for (long long i = 1; i <= n; i++) cout << cnt[i] << ' ';
}
int main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long l = -1e19, r = 1e10;
  while (l + 1 < r) {
    long long mid = (l + r) / 2;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  long long dl;
  if (check(r))
    dl = r;
  else
    dl = l;
  out(dl);
}
