#include <bits/stdc++.h>
using namespace std;
using INT = long long;
using pii = pair<int, int>;
int a[100100];
INT sum[100100];
pii p[100100];
int ans[100100], n;
INT k;
INT calc(INT x, int id) { return a[id] - 3 * x * x + 3 * x - 1; }
INT ok(INT x) {
  INT tot = 0;
  for (int i = 1; i <= n; i++) {
    int st = 0, ed = a[i] + 1;
    while (st + 1 < ed) {
      int md = (st + ed) >> 1;
      if (calc(md, i) >= x)
        st = md;
      else
        ed = md;
    }
    tot += st;
  }
  if (tot >= k) return tot - k + 1;
  return 0;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  INT st = -3e18, ed = 1e9;
  while (st + 1 < ed) {
    INT md = (st + ed) >> 1;
    if (ok(md))
      st = md;
    else
      ed = md;
  }
  INT d = st;
  INT m = ok(d);
  m--;
  for (int i = 1; i <= n; i++) {
    int st = 0, ed = a[i] + 1;
    while (st + 1 < ed) {
      int md = (st + ed) >> 1;
      if (calc(md, i) >= d)
        st = md;
      else
        ed = md;
    }
    if (calc(st, i) == d && m) m--, st--;
    printf("%d ", st);
  }
  cout << endl;
}
