#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n;
long long k, k2, r = 2000000000 * 2000000000LL, l, num;
long long b[100005], a[100005];
long long check(long long x) {
  int i, ans;
  long long sum = 0, l, r, mid;
  for (i = 1; i <= n; i++) {
    l = 0, r = a[i];
    while (l <= r) {
      mid = (l + r) >> 1;
      if (a[i] - 3 * mid * mid - 3 * mid - 1 >= x)
        ans = mid, l = mid + 1;
      else
        r = mid - 1;
    }
    b[i] = ans;
    sum += ans;
  }
  return sum;
}
struct S {
  long long num;
  int id;
  bool operator<(const S &a) const { return num > a.num; }
};
priority_queue<S> q;
int main() {
  int i, j, u, v;
  n = read(), k = read();
  for (i = 1; i <= n; i++) a[i] = read();
  l = -r;
  long long mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid) < k)
      r = mid - 1;
    else
      num = mid, l = mid + 1;
  }
  k2 = check(num);
  if (k2 == k)
    for (i = 1; i <= n; i++) printf("%lld ", b[i]);
  else {
    S A;
    k2 -= k;
    for (i = 1; i <= n; i++)
      A.num = a[i] - 3 * b[i] * b[i] + 3 * b[i] - 1, A.id = i, q.push(A);
    while (k2--) {
      A = q.top(), q.pop();
      b[A.id]--;
      if (b[A.id]) A.num = a[i] - 3 * b[i] * b[i] + 3 * b[i] - 1, q.push(A);
    }
    for (i = 1; i <= n; i++) printf("%lld ", b[i]);
  }
  return 0;
}
