#include <bits/stdc++.h>
using namespace std;
int n, a[100009], ans[100009];
long long k;
long long solve(long long x) {
  long long cnt = 0;
  for (int i = 1; i <= n; i++) {
    long double sq = 9 - (long double)12 * (x - a[i] + 1);
    if (sq < 0) continue;
    cnt += min((long long)(0.5 + sqrt(sq) / 6), 1LL * a[i]);
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long low = -4e18, high = 2e9, m;
  while (low < high) {
    m = (low + high + 1) / 2;
    if (solve(m) >= k)
      low = m;
    else
      high = m - 1;
  }
  vector<pair<long long, int> > v;
  for (int i = 1; i <= n; i++) {
    long double sq = 9 - (long double)12 * (low - a[i] + 1);
    if (sq < 0) continue;
    ans[i] = min((long long)(0.5 + sqrt(sq) / 6), 1LL * a[i]);
    k -= ans[i];
    v.push_back({-3ll * ans[i] * ans[i] + 3ll * ans[i] + a[i] - 1, i});
  }
  sort(v.rbegin(), v.rend());
  while (k++) ans[v.back().second]--, v.pop_back();
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
}
