#include <bits/stdc++.h>
long long n, m, sum = 0;
long long a[100005], b[100005];
inline long long read() {
  register long long x = 0, f = 1;
  register char s = getchar();
  while (s > '9' || s < '0') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  return x * f;
}
inline long long f(long long x, long long y) {
  return x == y ? LLONG_MAX : x - 3 * y * (y + 1) - 1;
}
inline long long calc(long long x, long long lim) {
  long long l = 0, r = a[x], res = a[x];
  while (l <= r) {
    int mid = l + r >> 1;
    if (f(a[x], mid) <= lim) {
      r = mid - 1;
      res = mid;
    } else {
      l = mid + 1;
    }
  }
  return res;
}
inline bool check(long long x) {
  sum = 0;
  for (register int i = 1; i <= n; ++i) {
    b[i] = calc(i, x);
    sum += b[i];
  }
  return sum < m;
}
int main() {
  n = read();
  m = read();
  long long l = 0, r = 0;
  for (register int i = 1; i <= n; ++i) {
    a[i] = read();
    l = ((l) < (f(a[i], a[i] - 1)) ? (l) : (f(a[i], a[i] - 1)));
    r = ((r) > (f(a[i], 0)) ? (r) : (f(a[i], 0)));
  }
  while (l + 1 < r) {
    long long mid = l + r >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  if (check(l)) r = l;
  check(r);
  m -= sum;
  for (register int i = 1; i <= n; ++i)
    if (m > 0 && b[i] < a[i] && f(a[i], b[i]) == r) ++b[i], --m;
  for (register int i = 1; i <= n; ++i) printf("%lld ", b[i]);
  return 0;
}
