#include <bits/stdc++.h>
using namespace std;
template <class T, class V>
ostream &operator<<(ostream &s, pair<T, V> a) {
  s << a.first << ' ' << a.second;
  return s;
}
long long int decrem(long long int a, long long int b) {
  return a - 3 * b * b + 3 * b - 1;
}
long long int solve(long long int a, long long int dm) {
  double d = 9.0 - 4.0 * 3.0 * (-a + 1.0 + dm);
  if (d < 0) return 0;
  d = sqrt(d);
  d += 3;
  d /= 6.0;
  return min(a, (long long int)ceil(d));
}
bool pos(vector<long long int> &a, long long int dm, long long int k) {
  long long int l = 0;
  for (auto x : a) l += solve(x, dm);
  return l >= k;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T = 1;
  for (long long int qq = 1; qq <= T; qq++) {
    long long int n, k;
    cin >> n >> k;
    vector<long long int> a(n);
    for (auto &x : a) cin >> x;
    long long int lo = -4e18, hi = 4e18;
    while (lo < hi) {
      long long int mid = (lo + hi + 1) / 2;
      if (pos(a, mid, k))
        lo = mid;
      else
        hi = mid - 1;
    }
    vector<long long int> b(n);
    priority_queue<pair<long long int, long long int> > pq;
    for (int i = 0; i < n; i++) {
      b[i] = solve(a[i], lo);
      k -= b[i];
      if (b[i])
        pq.push(pair<long long int, long long int>(-decrem(a[i], b[i]), i));
    }
    assert(k >= -1e7);
    while (k++) {
      pair<long long int, long long int> x = pq.top();
      pq.pop();
      if (--b[x.second])
        pq.push(pair<long long int, long long int>(
            -decrem(a[x.second], b[x.second]), x.second));
    }
    for (auto x : b) cout << x << ' ';
    cout << endl;
  }
  return 0;
}
