#include <bits/stdc++.h>
using namespace std;
const int max_n = 100005;
int n;
long long k, a[max_n];
long long b[max_n];
bool check(long long m, int f = 0) {
  auto cal = [&](long long x) {
    long long l = 0, r = 1e9;
    long long mid, ans = -1;
    while (l <= r) {
      mid = l + r >> 1;
      if (3 * mid * mid + 3 * mid <= x)
        ans = mid, l = mid + 1;
      else
        r = mid - 1;
    }
    return ans;
  };
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    long long c = cal(a[i] - 1 - m);
    c = min(c, a[i] - 1);
    c++;
    if (f) b[i] = c;
    res += c;
  }
  return res <= k;
}
int main() {
  scanf("%d%lld", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", a + i);
  long long l = -3.3e18, r = 1e9;
  long long mid, ans;
  while (l <= r) {
    mid = l + (r - l + 1) / 2;
    if (check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  check(ans, 1);
  k -= accumulate(b + 1, b + n + 1, 0ll);
  for (int i = 1; i <= n && k; i++) {
    if (b[i] < a[i] && 3 * b[i] * b[i] + 3 * b[i] <= a[i] - 1 - (ans - 1))
      k--, b[i]++;
  }
  for (int i = 1; i <= n; i++) printf("%lld ", b[i]);
  printf("\n");
  return 0;
}
