#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const long long inf = 9e18;
struct NODE {
  long long v, id;
  bool operator<(const NODE& other) const {
    return v > other.v || (v == other.v && id > other.id);
  }
} node[N];
long long a[N], b[N];
long long n;
long long f(long long x, long long y) { return x - 3LL * y * y + 3LL * y - 1; }
long long find(long long v, long long x) {
  long long l, r, mid;
  l = 0;
  r = x + 1;
  while (r - l > 1) {
    mid = (l + r) >> 1;
    if (f(x, mid) >= v)
      l = mid;
    else
      r = mid;
  }
  return l;
}
long long solve(long long x) {
  long long tot = 0;
  int i;
  for (i = 1; i <= n; i++) {
    tot += (b[i] = find(x, a[i]));
  }
  return tot;
}
int main() {
  long long k;
  int i, cnt = 0;
  long long l = inf, r = -inf, mid, tot;
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    l = min(l, f(a[i], a[i]));
    r = max(r, f(a[i], 1));
  }
  while (r - l > 1) {
    mid = (l + r) >> 1;
    if (solve(mid) <= k)
      r = mid;
    else
      l = mid;
  }
  tot = solve(r);
  for (i = 1; i <= n; i++)
    if (b[i] < a[i]) node[++cnt].v = f(a[i], b[i] + 1), node[cnt].id = i;
  sort(node + 1, node + cnt + 1);
  for (i = 1; i <= cnt; i++) {
    if (tot == k) break;
    b[node[i].id]++;
    tot++;
  }
  for (i = 1; i <= n; i++) cout << b[i] << " ";
  return 0;
}
