#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x * f;
}
int n, c[100010];
long long a[100010], k, b[100010];
inline long long calc(int i, long long x) {
  return a[i] - 3 * x * x - 3 * x - 1;
}
long long check(long long lim) {
  long long tot = 0;
  for (int i = 1; i <= n; ++i) {
    long long l = 0, r = a[i] + 1, ans = 0;
    while (l < r) {
      long long mid = (l + r) >> 1;
      if (calc(i, mid) >= lim) {
        ans = mid, l = mid + 1;
      } else {
        r = mid;
      }
    }
    b[i] = ans;
    if (b[i] > 0 && calc(i, b[i]) == lim)
      c[i] = 1;
    else
      c[i] = 0;
    tot += b[i];
  }
  return tot;
}
int main() {
  n = read(), k = read();
  for (int i = 1; i <= n; ++i) {
    a[i] = read();
  }
  long long l = -4e18, r = 4e18, ans = 0;
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (check(mid) >= k) {
      ans = mid, l = mid + 1;
    } else {
      r = mid;
    }
  }
  k = check(ans) - k;
  for (int i = 1; i <= n && k; ++i) {
    if (c[i]) --b[i], --k;
  }
  for (int i = 1; i <= n; ++i) {
    printf("%lld ", b[i]);
  }
  printf("\n");
  return 0;
}
