#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  long long k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  auto test = [&](long long x, vector<int>& res) {
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      int l = 1, r = a[i];
      while (l <= r) {
        int mid = l + r >> 1;
        if (a[i] - 3ll * mid * (mid + 1) - 1 >= x)
          l = mid + 1;
        else
          r = mid - 1;
      }
      if ((int)res.size()) res[i] = r;
      ans += r;
    }
    return ans;
  };
  long long l = -4e18, r = 4e18;
  vector<int> res;
  while (l <= r) {
    long long mid = l + r >> 1;
    if (test(mid, res) <= k)
      r = mid - 1;
    else
      l = mid + 1;
  }
  assert(test(l - 1, res) >= k);
  res.resize(n);
  k -= test(l, res);
  priority_queue<pair<long long, int>> pq;
  for (int i = 0; i < n; i++) {
    if (res[i] != a[i]) pq.emplace(a[i] - 3ll * res[i] * (res[i] + 1) - 1, i);
  }
  while (k-- > 0) {
    res[pq.top().second]++;
    pq.pop();
  }
  for (int i = 0; i < n; i++) cout << res[i] << " ";
}
