#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 10;
int n;
long long k;
long long a[maxN];
const long long INF = 4e18;
long long cnt[maxN];
long long solve(long long val, long long lim) {
  long long lower = val - lim - 1;
  if (lower < 0) return 0;
  if (3 * (val - 1) * (val - 1) + 3 * (val - 1) <= lower) return val;
  long long l = 0;
  long long r = val - 1;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (3 * mid * mid + 3 * mid <= lower)
      l = mid;
    else
      r = mid;
  }
  return l + 1;
}
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 = -INF;
  long long r = (long long)1e12;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    long long cur = 0;
    for (int i = 1; i <= n; i++) {
      cur += solve(a[i], mid);
    }
    if (cur >= k)
      l = mid;
    else
      r = mid;
  }
  for (int i = 1; i <= n; i++) {
    cnt[i] = solve(a[i], l + 1);
    k -= cnt[i];
  }
  for (int i = 1; i <= n; i++) {
    while (k > 0 && cnt[i] + 1 <= a[i] &&
           a[i] - 3 * cnt[i] * (cnt[i] + 1) - 1 == l) {
      cnt[i]++;
      k--;
    }
  }
  for (int i = 1; i <= n; i++) cout << cnt[i] << " ";
  assert(k == 0);
  return 0;
}
