#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
int b[maxn];
int n;
long long k;
long long d(int i, long long x) { return a[i] - 3LL * x * x + 3 * x - 1; }
bool check(long long lim) {
  long long res = 0;
  for (int i = 1; i <= n; ++i) {
    if (d(i, 1) < lim) {
      b[i] = 0;
      continue;
    }
    if (d(i, a[i]) >= lim) {
      b[i] = a[i];
      res += a[i];
      continue;
    }
    long long l = 0, r = a[i];
    long long t = 10086;
    while (l <= r) {
      if (d(i, ((l + r) >> 1)) >= lim)
        t = ((l + r) >> 1), l = ((l + r) >> 1) + 1;
      else
        r = ((l + r) >> 1) - 1;
    }
    assert(t != 100866);
    b[i] = t;
    res += t;
  }
  return res >= k;
}
int main() {
  scanf("%d%lld", &n, &k);
  for (int i = (1); i < (n + 1); ++i) scanf("%d", &a[i]);
  long long l = -4 * 1e18, r = 1e9 + 1;
  long long ans = 10086;
  while (l <= r) {
    if (check(((l + r) >> 1)))
      ans = ((l + r) >> 1), l = ((l + r) >> 1) + 1;
    else
      r = ((l + r) >> 1) - 1;
  }
  assert(check(ans));
  long long sum = 0;
  for (int i = (1); i < (n + 1); ++i) {
    sum += b[i];
  }
  for (int i = (1); i < (n + 1); ++i) {
    if (sum > k && b[i] > 0 && d(i, b[i]) == ans) sum--, b[i]--;
  }
  for (int i = (1); i < (n + 1); ++i) {
    printf("%d ", b[i]);
  }
}
