#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 100005;
const long long M = 4000000009000000009;
int n;
long long k;
long long a[N];
long long stg(long long x) {
  long long k = 0;
  for (int i = 1; i <= n; ++i) {
    long long l = 0, r = a[i];
    long long u = 0;
    while (l <= r) {
      long long m = (l + r) / 2;
      long long s = a[i] - 3 * m * m + 3 * m - 1;
      if (s >= x) {
        u = m;
        l = m + 1;
      } else
        r = m - 1;
    }
    k += u;
  }
  return k;
}
long long b[N];
void solv() {
  scanf("%d%lld", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  long long l = -M, r = M;
  assert(stg(-M) >= k);
  long long x;
  while (l <= r) {
    long long m = (l + r) / 2;
    if (stg(m) >= k) {
      x = m;
      l = m + 1;
    } else
      r = m - 1;
  }
  vector<pair<long long, int> > v;
  long long kk = 0;
  for (int i = 1; i <= n; ++i) {
    long long l = 0, r = a[i];
    long long u = 0;
    while (l <= r) {
      long long m = (l + r) / 2;
      long long s = a[i] - 3 * m * m + 3 * m - 1;
      if (s >= x) {
        u = m;
        l = m + 1;
      } else
        r = m - 1;
    }
    kk += u;
    b[i] = u;
    if (u) {
      v.push_back(make_pair(a[i] - 3 * u * u + 3 * u - 1, i));
    }
  }
  sort((v).begin(), (v).end());
  for (int i = 0; i < (kk - k); ++i) b[v[i].second]--;
  for (int i = 1; i <= n; ++i) printf("%lld ", b[i]);
  printf("\n");
}
int main() {
  solv();
  return 0;
}
