#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  long long tsum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    tsum += a[i];
  }
  if (tsum == k) {
    for (int i = 0; i < n; i++) {
      cout << a[i] << " ";
    }
    cout << endl;
    return 0;
  }
  double up = 4e18;
  double dn = -1e9;
  while (true) {
    double mid = (up + dn) / 2;
    double sum = 0;
    for (int i = 0; i < n; i++)
      sum += min(sqrt(max(a[i] + mid, 0.0) / 3), (double)a[i]);
    if (sum <= k) {
      dn = mid;
      if (k - sum < n) break;
    } else
      up = mid;
  }
  vector<long long> b(n);
  long long sum = 0;
  double fval = 0;
  const long long INF = 1e18;
  vector<array<long long, 2>> hp(n);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    b[i] = min((long long)sqrt(max(a[i] + dn, 0.0) / 3), a[i]);
    if (b[i] < a[i]) {
      hp[cnt][0] = a[i] - 3 * b[i] * b[i] - 2 * b[i] - 2;
      hp[cnt][1] = i;
      cnt++;
    }
    sum += b[i];
    fval += b[i] * (a[i] - (double)b[i] * b[i]);
  }
  make_heap(hp.begin(), hp.begin() + cnt);
  while (sum < k) {
    pop_heap(hp.begin(), hp.begin() + cnt);
    cnt--;
    int i = hp[cnt][1];
    fval += hp[cnt][0];
    sum++;
    b[i]++;
    if (b[i] < a[i]) {
      hp[cnt][0] = a[i] - 3 * b[i] * b[i] - 2 * b[i] - 2;
      cnt++;
      push_heap(hp.begin(), hp.begin() + cnt);
    };
  }
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << endl;
  return 0;
}
