#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 2;
long long n, a[maxn], k, ans[maxn];
long long Check(long long m) {
  long long res = 0, l, r, mid;
  for (int i = 1; i <= n; i++) {
    l = 1;
    r = a[i];
    while (l <= r) {
      mid = (l + r) / 2;
      if (a[i] - 3 * mid * (mid + 1) - 1 >= m)
        l = mid + 1;
      else
        r = mid - 1;
    }
    ans[i] = r;
    res += r;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long l = -4e18, r = 4e18, mid;
  while (l <= r) {
    mid = (l + r) / 2;
    if (Check(mid) >= k)
      l = mid + 1;
    else
      r = mid - 1;
  }
  long long sum = Check(l);
  for (int i = 1; i <= n; i++)
    if (sum < k && ans[i] < a[i] &&
        a[i] - 3 * (ans[i] + 1) * (ans[i] + 2) - 1 == l - 1) {
      sum++;
      ans[i]++;
    }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
}
