#include <bits/stdc++.h>
using namespace std;
void one_case() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  long long A = 0;
  for (auto& el : a) {
    cin >> el;
    A = max(el, A);
  }
  vector<long long> ans;
  long long l = -3 * A * A;
  long long r = A + 1;
  vector<long long> b(n);
  while (l < r) {
    auto min_d = l + (r - l) / 2;
    vector<int> on_bound;
    long long taken = 0;
    b.assign(n, 0);
    for (int item = 0; item < n; ++item) {
      long long left = 1, right = a[item] + 1;
      while (left < right) {
        auto take = left + (right - left) / 2;
        if (a[item] - 3 * take * take + take - 1 < min_d) {
          right = take;
        } else {
          left = take + 1;
        }
      }
      --left;
      b[item] = left;
      taken += left;
      if (a[item] - 3 * left * left + left - 1 == min_d && left) {
        on_bound.push_back(item);
      }
    }
    while (taken > k && !on_bound.empty()) {
      --taken;
      --b[on_bound.back()];
      on_bound.pop_back();
    }
    if (taken < k) {
      r = min_d;
    } else {
      ans = b;
      l = min_d + 1;
    }
  }
  for (auto el : ans) {
    cout << el << " ";
  }
  cout << "\n";
}
int main() {
  int t = 1;
  while (t--) {
    one_case();
  }
  return 0;
}
