#include <bits/stdc++.h>
using namespace std;
const int maxn = 112345;
int n, a[maxn], b[maxn];
long long k;
inline long long get(long long x, long long y) {
  return x - 3 * y * y + 3 * y - 1;
}
inline long long check(long long x) {
  long long tot = 0;
  for (int i = 1; i <= n; ++i) {
    int left = 1, right = a[i], res = 0;
    while (left <= right) {
      int mid = (left + right) >> 1;
      if (get(a[i], mid) >= x) {
        res = mid;
        left = mid + 1;
      } else
        right = mid - 1;
    }
    tot += (b[i] = res);
  }
  return tot;
}
int main() {
  scanf("%d%I64d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  long long left = -3e18, right = 1e9, res = -3e18;
  while (left <= right) {
    long long mid = (left + right) >> 1;
    if (check(mid) >= k) {
      left = mid + 1;
      res = mid;
    } else
      right = mid - 1;
  }
  long long rev = check(res) - k;
  if (rev > n) {
    printf("rev=%I64d\n", rev);
    printf("res=%I64d\n", res);
    printf("check1=%I64d\n", check(res));
    printf("check2=%I64d\n", check(res - 1));
  }
  for (int i = 1; i <= n; ++i) {
    if (rev && get(a[i], b[i]) == res) --b[i], --rev;
    printf("%d%c", b[i], " \n"[i == n]);
  }
  return 0;
}
