#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10;
const long long INF = 4e18;
long long n, k;
long long a[N], b[N], sum;
long long calc(long long i, long long x) {
  return a[i] - 3 * x * x - 3 * x - 1;
}
bool check(long long A) {
  long long res = 0;
  for (long long i = 1; i <= n; i++) {
    long long l = 0, r = a[i];
    while (l < r) {
      long long mid = l + r + 1 >> 1;
      if (calc(i, mid) >= A)
        l = mid;
      else
        r = mid - 1;
    }
    if (calc(i, l) < A) return false;
    b[i] = l;
    res += b[i];
  }
  sum = res;
  return res >= k;
}
signed main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long l = -INF, r = INF;
  while (l < r) {
    long long mid = l + r + 1 >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  check(l);
  sum -= k;
  for (long long i = 1; i <= n; i++)
    if (sum != 0 && calc(i, b[i]) == l) {
      b[i]--;
      sum--;
    }
  for (long long i = 1; i <= n; i++) cout << b[i] << " ";
  return 0;
}
