#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long n, k;
long long a[N], b[N];
long long cal(long long a, long long x) { return a - 3 * x * x + 3 * x - 1; }
bool check(long long Y) {
  long long cnt = 0;
  for (int i = 1; i <= n; i++) {
    int l = 0, r = a[i];
    while (l <= r) {
      int mid = l + r >> 1;
      if (cal(a[i], mid) >= Y)
        l = mid + 1;
      else
        r = mid - 1;
    }
    b[i] = l - 1;
    cnt += b[i];
  }
  return cnt >= k;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  long long l = -4e18, r = 4e18, Y;
  while (l <= r) {
    long long mid = l + r >> 1;
    if (check(mid)) {
      Y = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  check(Y);
  long long cnt = 0;
  for (int i = 1; i <= n; i++) cnt += b[i];
  cnt -= k;
  for (int i = 1; i <= n && cnt; i++) {
    if (b[i] && cal(a[i], b[i]) == Y) {
      cnt--;
      b[i]--;
    }
  }
  for (int i = 1; i <= n; i++) printf("%lld%c", b[i], i == n ? '\n' : ' ');
  return 0;
}
