#include <bits/stdc++.h>
long long a[100005];
long long count[100005];
int vis[100005];
struct Element {
  long long l, r;
  Element(long long l, long long r) : l(l), r(r) {}
};
Element getCount(long long k, int n) {
  long long lower = 0, upper = 0;
  int met = 0;
  for (int i = 1; i <= n; i++) {
    long long l = 1, r = a[i];
    long long res = 0;
    while (l <= r) {
      long long m = (l + r) / 2;
      long long value = a[i] - 3ll * m * m + 3 * m - 1;
      if (value >= k) {
        res = m;
        l = m + 1;
      } else
        r = m - 1;
    }
    lower += res, upper += res;
    count[i] = res;
    long long value = a[i] - 3ll * res * res + 3 * res - 1;
    if (value == k) {
      vis[i] = 1;
      count[i]--;
      if (!met)
        met = 1;
      else
        lower--;
    } else
      vis[i] = 0;
  }
  return Element(lower, upper);
}
int main() {
  int n;
  long long k;
  scanf("%d%lld", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  long long l = -3e18, r = 1e10;
  while (l <= r) {
    long long m = (l + r) / 2;
    Element u = getCount(m, n);
    if (u.l > k)
      l = m + 1;
    else if (u.r < k)
      r = m - 1;
    else {
      break;
    }
  }
  long long need = k;
  for (int i = 1; i <= n; i++) need -= count[i];
  for (int i = 1; i <= n; i++) {
    if (need && vis[i]) {
      need--;
      count[i]++;
    }
    printf("%lld ", count[i]);
  }
  printf("\n");
  return 0;
}
