#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 7;
const int MOD = (int)1e9 + 7;
const long long INF = (long long)1e18 + 7;
long long n, k, all;
long long a[N], res[N];
long long Get(long long a, long long x) {
  return a - 3LL * x * (x - 1LL) - 1LL;
}
int check(long long x) {
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    long long l = 0, r = a[i];
    res[i] = 0;
    while (l <= r) {
      long long m = (l + r) >> 1;
      if (Get(a[i], m) >= x) {
        res[i] = m;
        l = m + 1;
      } else
        r = m - 1;
    }
    sum += res[i];
  }
  all = sum;
  return sum <= k;
}
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 l = -3e18, r = 1e9;
  long long ans = l;
  while (l <= r) {
    long long m = (l + r) >> 1;
    if (check(m)) {
      ans = m;
      r = m - 1;
    } else
      l = m + 1;
  }
  check(ans);
  k -= all;
  for (int i = 1; i <= n; i++)
    if (k && res[i] < a[i] && Get(a[i], res[i] + 1) == ans - 1) res[i]++, k--;
  for (int i = 1; i <= n; i++) cout << res[i] << " ";
}
