#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, b[N];
long long m, a[N], tot;
pair<long long, int> s[N];
int cnt;
long long f(long long x, long long y) { return y - 1 - 3 * x * (x - 1); }
int calc(long long x, long long t) {
  int l = 1, r = x + 1, mid;
  while (l < r) {
    mid = l + r >> 1;
    if (f(mid, x) < t)
      r = mid;
    else
      l = mid + 1;
  }
  return l - 1;
}
bool check(long long x) {
  tot = 0;
  for (int i = 1; i <= n && tot <= m; i++) tot += (b[i] = calc(a[i], x));
  return tot <= m;
}
int main() {
  scanf("%d %lld", &n, &m);
  long long l = 9e18, r = 0, mid;
  for (int i = 1; i <= n; i++)
    scanf("%lld", &a[i]), r = max(r, f(1, a[i])), l = min(l, f(a[i], a[i]));
  while (l < r) {
    mid = l + r >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  check(l);
  m = m - tot;
  if (m)
    for (int i = 1; i <= n; i++)
      if (b[i] < a[i]) s[++cnt] = make_pair(f(b[i] + 1, a[i]), i);
  sort(s + 1, s + cnt + 1, greater<pair<long long, int> >());
  for (int i = 1; i <= m; i++) b[s[i].second]++;
  for (int i = 1; i <= n; i++) printf("%d ", b[i]);
  return 0;
}
