#include <bits/stdc++.h>
using namespace std;
long long int a[100001], b[100001], n, k, w = 0;
long long int calc(long long int i, long long int x) {
  return a[i] - 3 * x * x + 3 * x - 1;
}
long long int check(long long int x) {
  w = 0;
  for (long long int i = 0; i < n; ++i) {
    long long int l = 1, r = a[i];
    while (l <= r) {
      long long int mid = (l + r) >> 1;
      if (calc(i, mid) >= x)
        l = mid + 1;
      else
        r = mid - 1;
    }
    w += r;
    b[i] = r;
  }
  return w;
}
int main() {
  cin >> n >> k;
  for (long long int i = 0; i < n; ++i) cin >> a[i];
  long long int l = -3e18, r = 2e9;
  while (l <= r) {
    long long int mid = (l + r) >> 1;
    if (check(mid) >= k)
      l = mid + 1;
    else
      r = mid - 1;
  }
  check(r);
  w -= k;
  for (long long int i = 0; i < n; ++i) {
    long long int p = 0;
    if (w != 0 && calc(i, b[i]) == r) {
      p = 1;
      --w;
    }
    cout << b[i] - p << " ";
  }
}
