#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
long long a[MAXN];
long long b[MAXN];
int soman[MAXN];
long long f(long long n) { return n * n * 3 + n * 3 + 1; }
long long sq(long long a, long long b) {
  if (a < 0) return 0;
  long long n = sqrtl(a / double(b));
  if ((n + 1) * (n + 2) * 3 <= a)
    n++;
  else if ((n) * (n + 1) * 3 > a)
    n--;
  return n;
}
long long n;
long long solve(long long x) {
  long long got = 0;
  for (long long i = 1; i <= n; i++) {
    b[i] = sq(a[i] - x - 1, 3);
    b[i] = min(b[i], a[i]);
    got += b[i];
  }
  return got;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long hi = a[1] - f(1), lo = a[1] - f(a[1]);
  for (long long i = 2; i <= n; i++) {
    hi = max(hi, a[i] - f(1));
    lo = min(lo, a[i] - f(a[i]));
  }
  while (lo <= hi) {
    long long mid = (lo + hi) / 2;
    if (solve(mid) < k)
      hi = mid - 1;
    else
      lo = mid + 1;
  }
  long long got = solve(hi);
  assert(got >= k);
  for (long long i = 1; i <= n && got > k; i++) {
    if (b[i] == 0) continue;
    long long last = a[i] - f(b[i]);
    if (last == hi) {
      b[i]--;
      got--;
    }
  }
  for (long long i = 1; i <= n; i++) cout << b[i] << " ";
  cout << "\n";
  return 0;
}
