#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int N = 2e5 + 10;
const long long mod = 998244353;
const int bits = 19;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> arr(n), brr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  auto delta = [&](int i, long long x) {
    return arr[i] - 3 * x - 3 * x * x - 1;
  };
  auto cal = [&](long long A) {
    long long tot = 0;
    for (int i = 0; i < n; i++) {
      long double a = 3, b = 3, c = 1 + A - arr[i];
      long double d = b * b - 4 * a * c;
      if (d >= 0) {
        d = sqrt(d);
        long double ans = (-b + d) / (2 * a);
        brr[i] = ceil(ans);
        brr[i] = min(brr[i], arr[i]);
      } else {
        brr[i] = 0;
      }
      tot += brr[i];
    }
    return tot;
  };
  long long low = -4e18, high = 4e18;
  while (low + 1 < high) {
    long long mid = (low + high) / 2;
    if (cal(mid) >= k) {
      low = mid;
    } else {
      high = mid;
    }
  }
  k -= cal(high);
  priority_queue<array<long long, 2>> pq;
  for (int i = 0; i < n; i++) {
    pq.push({delta(i, brr[i]), i});
  }
  for (int i = 1; i <= k;) {
    auto tp = pq.top();
    pq.pop();
    int ele = tp[1];
    if (brr[ele] >= arr[ele]) continue;
    brr[ele]++;
    i++;
    pq.push({delta(ele, brr[ele]), ele});
  }
  for (int i = 0; i < n; i++) {
    cout << brr[i] << " ";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  std::cout << std::fixed << std::setprecision(20);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
}
