#include <bits/stdc++.h>
using namespace std;
constexpr long long MAXN = 1e5 + 5;
long long n, k, l = 1e18, r = -1e18, sum;
array<long long, MAXN> a, b;
inline long long f(long long x, long long i) {
  if (x == a[i]) return 1e18;
  return a[i] - 3 * x * x + 3 * x - 1;
}
inline long long calc(long long i, long long lim) {
  long long l = 1, r = a[i], res = a[i];
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (f(mid, i) <= lim)
      r = mid - 1, res = mid;
    else
      l = mid + 1;
  }
  return res;
}
inline bool check(long long mid) {
  sum = 0;
  for (long long i = 1; i <= n; i++) {
    b[i] = calc(i, mid);
    sum += b[i];
  }
  return sum < k;
}
signed main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    l = min(l, f(a[i] - 1, i));
    r = max(r, f(0, i));
  }
  while (r - l > 1) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  if (check(l)) r = l;
  check(r);
  k -= sum;
  for (long long i = 1; i <= n; i++)
    if (k && b[i] < a[i] && f(b[i], i) == r) b[i]++, k--;
  for (long long i = 1; i <= n; i++) cout << b[i] << " ";
  return 0;
}
