#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int inf = 1e9 + 5;
const int mod = 998244353;
const int logN = 17;
int n, m;
long long k;
long long a[N];
long long b[N];
long long getK(double dx) {
  long long K = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] < dx) {
      b[i] = 0;
      continue;
    }
    long long xx = sqrt((1.0 * a[i] - dx) / 3.0) - 0.0000000001;
    if (xx > a[i]) xx = a[i];
    K += xx;
    b[i] = xx;
  }
  return K;
}
int main() {
  scanf("%d %lld", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  double low = -(3e18 + 5), high = 1e9;
  for (int i = 1; i <= 300; i++) {
    double mid = (low + high) / 2.0;
    long long K = getK(mid);
    if (K <= k)
      high = mid;
    else
      low = mid;
  }
  long long K = getK(high);
  k -= K;
  priority_queue<pair<long long, long long> > q;
  for (int i = 1; i <= n; i++) {
    long long fark = -3 * b[i] * (long long)b[i] - 3LL * b[i] + a[i] - 1;
    if (b[i] < a[i]) {
      q.push(make_pair(fark, (long long)i));
    }
  }
  while (k--) {
    pair<long long, long long> x = q.top();
    q.pop();
    long long i = x.second;
    b[i]++;
    long long fark = -3 * b[i] * (long long)b[i] - 3LL * b[i] + a[i] - 1;
    if (b[i] < a[i]) {
      q.push(make_pair(fark, i));
    }
  }
  for (int i = 1; i <= n; i++) cout << b[i] << ' ';
  cout << endl;
  return 0;
}
