#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10;
long long f(long long a, long long x) { return (a - 3ll * x * x + 3 * x - 1); }
bool checkcalc(long long x, long long a, long long val) {
  return (f(a, x) > val);
}
long long calc(long long a, long long val) {
  long long hi = a + 10, lo = 0;
  long long m;
  while (hi - lo > 1) {
    m = (lo + hi) / 2;
    if (checkcalc(m, a, val))
      lo = m;
    else
      hi = m;
  }
  if (checkcalc(hi, a, val)) return hi;
  return lo;
}
long long n, k;
long long a[N];
long long b[N];
bool check(long long val) {
  long long tot = 0;
  for (long long i = 0; i < n; ++i) {
    b[i] = min(a[i], calc(a[i], val));
    tot += b[i];
  }
  return (tot >= k);
}
void solve() {
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  long long hi = 2e9, lo = -4e18;
  long long m;
  while (hi - lo > 1) {
    m = (hi + lo) / 2;
    if (check(m))
      lo = m;
    else
      hi = m;
  }
  check(hi);
  for (long long i = 0; i < n; ++i) k -= b[i];
  vector<pair<long long, long long>> av;
  for (long long i = 0; i < n; ++i) {
    if (b[i] == a[i]) continue;
    long long x = f(a[i], b[i]);
    if (x < hi) continue;
    av.push_back({f(a[i], b[i] + 1), i});
  }
  sort(av.begin(), av.end());
  reverse(av.begin(), av.end());
  for (long long i = 0; i < (long long)av.size() && k > 0; ++i) {
    k--;
    b[av[i].second]++;
  }
  assert(k == 0);
  for (long long i = 0; i < n; ++i) cout << b[i] << ' ';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
