#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
bool cmax(T& a, const U& b) {
  return a < b ? a = b, 1 : 0;
}
template <class T, class U>
bool cmin(T& a, const U& b) {
  return b < a ? a = b, 1 : 0;
}
void _BG(const char* s) { cerr << s << endl; }
template <class T, class... TT>
void _BG(const char* s, T a, TT... b) {
  for (size_t c = 0; *s && (c || *s != ','); cerr << *s++)
    c += count(begin("([{"), end("([{"), *s) -
         count(begin(")]}"), end(")]}"), *s);
  cerr << " = " << a;
  if (*s) {
    cerr << ", ";
    ++s;
  }
  _BG(s, b...);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  long long k;
  cin >> n >> k;
  vector<long long> a(n);
  vector<long double> b(n);
  vector<long long> ans(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  long double l = -1e9, r = ((long double)3) * k * k;
  for (int t = 0; t < 100; ++t) {
    long double m = (l + r) / 2;
    long double s = 0;
    for (int i = 0; i < n; ++i) {
      b[i] = min(sqrt(max((long double)0, (a[i] + m) / 3)), (long double)a[i]);
      s += b[i];
    }
    if (s > k)
      r = m;
    else
      l = m;
  }
  long long s = 0;
  priority_queue<pair<long long, long long> > pq;
  for (int i = 0; i < n; ++i) {
    b[i] = min(sqrt(max((long double)0, (a[i] + l) / 3)), (long double)a[i]);
    ans[i] = b[i];
    s += ans[i];
    if (ans[i] < a[i])
      pq.emplace(a[i] - 3 * ans[i] * ans[i] - 3 * ans[i] - 1, i);
  }
  int tot = 0;
  while (s < k && pq.size()) {
    if (tot++ % 100000 == 0) {
      cerr << tot << ' ' << s << endl;
    }
    s++;
    long long w, i;
    tie(w, i) = pq.top();
    pq.pop();
    ans[i]++;
    if (ans[i] < a[i])
      pq.emplace(a[i] - 3 * ans[i] * ans[i] - 3 * ans[i] - 1, i);
  }
  assert(s == k);
  for (int i = 0; i < n; ++i) cout << ans[i] << " \n"[i == n - 1];
}
