#include <bits/stdc++.h>
using namespace std;
function<void(void)> ____ = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
};
const int MAXN = 1e5 + 7;
long long int n, A[MAXN], B[MAXN];
long long int k;
inline long long int f(long long int x, long long int a) {
  return -3 * x * x + 3 * x + a - 1;
}
int calmax(int p, long long int m) {
  int l = 1, r = A[p];
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (f(mid, A[p]) >= m)
      l = mid + 1;
    else
      r = mid - 1;
  }
  return r;
}
bool check(long long int m) {
  long long int tot = 0;
  for (int i = 1; i <= n; i++) tot += calmax(i, m);
  return tot <= k;
}
int main() {
  ____();
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> A[i];
  long long int l = -4e18, r = 1e9;
  while (l <= r) {
    long long int mid = (l + r) >> 1;
    if (check(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  long long int tot = 0;
  vector<pair<long long int, int>> vec;
  for (int i = 1; i <= n; i++) {
    tot += B[i] = calmax(i, l);
    if (B[i] < A[i]) vec.emplace_back(make_pair(f(B[i] + 1, A[i]), i));
  }
  sort(vec.begin(), vec.end(), greater<pair<long long int, int>>());
  tot = k - tot;
  for (int i = 0; i < tot; i++) B[vec[i].second]++;
  for (int i = 1; i <= n; i++) cout << B[i] << ' ';
  cout << endl;
  return 0;
}
