#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma G++ optimize(2)
using namespace std;
const int MAX_N = 1e5 + 5;
long long n, k;
long long a[MAX_N], b[MAX_N];
bool use[MAX_N];
long long cal(int i, long long x) { return a[i] - 3 * x * x + 3 * x - 1; }
long long check(long long delta) {
  long long sum = 0;
  for (register int i = 1; i <= n; ++i) {
    if (cal(i, 1) < delta) {
      b[i] = 0, use[i] = false;
      continue;
    }
    long long l = 1, r = a[i], mid, ans;
    while (l <= r) {
      mid = (l + r) >> 1;
      if (cal(i, mid) >= delta)
        l = mid + 1, ans = mid;
      else
        r = mid - 1;
    }
    b[i] = ans;
    use[i] = (cal(i, ans) == delta);
    sum += ans;
  }
  return sum;
}
int main() {
  scanf("%lld", &n), scanf("%lld", &k);
  for (register int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  long long l = -4e18, r = 1e9, mid, ans;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid) >= k)
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  k -= check(ans);
  for (int i = 1; i <= n && k < 0; i++)
    if (use[i] && b[i]) ++k, --b[i];
  for (register int i = 1; i <= n; ++i)
    printf("%lld%c", b[i], i == n ? '\n' : ' ');
  return 0;
}
