#include <bits/stdc++.h>
using namespace std;
const int maxn = 110000;
int an[maxn];
int dn[maxn];
int tn[maxn];
int ans[maxn];
long long rn[maxn];
int ln[maxn];
bool cmp(int x, int y) { return an[x] < an[y]; }
bool cmp2(int x, int y) { return rn[x] > rn[y]; }
int main() {
  int n;
  long long k;
  scanf("%d%lld", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &an[i]);
    dn[i] = i;
  }
  sort(dn, dn + n, cmp);
  sort(an, an + n);
  long long l = 1LL * (-3) * an[n - 1] * an[n - 1] + an[n - 1],
            r = an[n - 1] + 1;
  while (l < r) {
    long long m = (r - l) / 2 + l;
    long long sum = 0;
    long long t = 0;
    for (int i = 0; i < n; i++) {
      long double x = (1.0l * an[i] - m) / 3;
      x = max(0.0l, x);
      x = sqrt(x);
      ans[i] = min((int)x, an[i]);
      if (ans[i] < an[i]) t++;
      rn[i] = 1LL * an[i] - 3LL * ans[i] * ans[i];
      sum += ans[i];
      tn[i] = i;
    }
    if (sum > k) {
      l = m + 1;
    } else if (sum + t < k) {
      r = m;
    } else {
      sort(tn, tn + n, cmp2);
      t = k - sum;
      for (int i = 0; i < n; i++) {
        if (t == 0) break;
        if (ans[tn[i]] < an[tn[i]]) {
          ans[tn[i]] += 1;
          t--;
        }
      }
      break;
    }
  }
  for (int i = 0; i < n; i++) {
    ln[dn[i]] = i;
  }
  for (int i = 0; i < n; i++) {
    printf("%d%c", ans[ln[i]], i == n - 1 ? '\n' : ' ');
  }
}
