#include <bits/stdc++.h>
using namespace std;
const int maxl = 3e5 + 10;
int n, m, cas;
long long k, ans;
long long a[maxl], b[maxl];
char s[maxl];
bool eqlans[maxl];
inline void prework() {
  scanf("%d%lld", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
}
inline long long calc(int i, long long x) {
  return a[i] - 3 * x * x + 3 * x - 1;
}
inline long long jug(long long delta) {
  long long sum = 0, l, r, mid, d;
  for (int i = 1; i <= n; i++) {
    l = 1, r = a[i];
    if (calc(i, 1) < delta) {
      b[i] = 0;
      eqlans[i] = false;
      continue;
    }
    while (l + 1 < r) {
      mid = (l + r) >> 1;
      if (calc(i, mid) >= delta)
        l = mid;
      else
        r = mid;
    }
    if (calc(i, r) >= delta)
      d = r;
    else
      d = r - 1;
    b[i] = d;
    eqlans[i] = (calc(i, d) == delta);
    sum += d;
  }
  return sum;
}
inline void mainwork() {
  long long l = -4e18, r = 1e9, mid;
  while (l + 1 < r) {
    mid = (l + r) >> 1;
    if (jug(mid) >= k)
      l = mid;
    else
      r = mid;
  }
  if (jug(r) >= k)
    ans = r;
  else if (jug(r - 1) >= k)
    ans = r - 1;
  k -= jug(ans);
  for (int i = 1; i <= n && k < 0; i++)
    if (eqlans[i] && b[i] > 0) ++k, --b[i];
}
inline void print() {
  for (int i = 1; i <= n; i++) printf("%lld%c", b[i], (i == n) ? '\n' : ' ');
}
int main() {
  int t = 1;
  for (cas = 1; cas <= t; cas++) {
    prework();
    mainwork();
    print();
  }
  return 0;
}
