#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("-O3")
const long long MAXN = (long long)1e5;
long long tab[MAXN];
long long n, k;
long long eval(long long x) { return -3 * x * x - 3 * x - 1; }
void input() {
  cin >> n >> k;
  for (long long i = 0; i < (n); ++i) cin >> tab[i];
}
long long ile(long long A, long long val) {
  if (val >= A) return 0;
  long long p = 0;
  long long q = A - 1;
  while (p != q) {
    long long s = (p + q + 1) / 2;
    if (A + eval(s) > val)
      p = s;
    else
      q = s - 1;
  }
  return p + 1;
}
bool ok(long long val) {
  long long z = 0;
  for (long long i = 0; i < (n); ++i) z += ile(tab[i], val);
  return z >= k;
}
int32_t main() {
  ios_base::sync_with_stdio(0), cout.setf(ios::fixed), cout.precision(10),
      cin.tie(0), cout.tie(0);
  ;
  input();
  long long p = -4e18;
  long long q = 3e9;
  while (p != q) {
    long long s = (p + q + 1) / 2;
    if (ok(s))
      p = s;
    else
      q = s - 1;
  }
  long long val = p;
  vector<long long> odp(n);
  for (long long i = 0; i < (n); ++i) odp[i] = ile(tab[i], val);
  long long a = accumulate((odp).begin(), (odp).end(), 0ll);
  for (long long i = 0; i < (n); ++i)
    if (a > k && ile(tab[i], val) != ile(tab[i], val + 1)) odp[i]--, a--;
  for (long long i = 0; i < (n); ++i) cout << odp[i] << " ";
  cout << "\n";
}
