#include <bits/stdc++.h>
using namespace std;
const long long int N = 100005;
long long int a[N], b[N];
long long int n, k;
long long int get(long long int i, long long int x) {
  return (a[i] - 3 * x * x + 3 * x - 1);
}
long long int query(long long int x) {
  long long int tot = 0;
  memset(b, 0, sizeof(b));
  for (long long int i = 1; i <= n; i++) {
    long long int t = 0;
    long long int lo = 0, ri = a[i];
    while (lo <= ri) {
      long long int mid = (lo + ri) / 2;
      if (get(i, mid) >= x) {
        t = mid;
        lo = mid + 1;
      } else {
        ri = mid - 1;
      }
    }
    b[i] = t;
    tot += t;
  }
  return tot;
}
int32_t main() {
  long long int i, l, r, mid, opt, rem;
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  l = -3e18, r = 3e18;
  while (l <= r) {
    mid = (l + r) / 2;
    if (query(mid) >= k) {
      opt = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  rem = query(opt) - k;
  for (i = 1; i <= n; i++) {
    if (get(i, b[i]) == opt && rem) {
      b[i]--;
      rem--;
    }
    cout << b[i] << " ";
  }
  return 0;
}
