#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
const int maxm = 1005;
const long long mod = 1000000007;
long long a[maxn], b[maxn], sum, k;
int n;
long long g(long long ai, long long x) { return ai - x * 3ll * (x + 1) - 1; }
long long calc(long long ai, long long x) {
  long long l = 0, r = ai;
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (g(ai, mid) > x)
      l = mid + 1;
    else
      r = mid;
  }
  if (g(ai, l) > x) return min(ai, l + 1);
  return l;
}
bool check(long long x) {
  sum = 0;
  for (int i = 1; i <= n; i++) {
    b[i] = calc(a[i], x);
    sum += b[i];
  }
  return sum < k;
}
int main() {
  scanf("%d%lld", &n, &k);
  long long l = mod, r = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    l = min(l, g(a[i], a[i] - 1));
    r = max(r, g(a[i], 0));
  }
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  check(l);
  k -= sum;
  for (int i = 1; i <= n; i++) {
    if (b[i] < a[i] && k > 0 && g(a[i], b[i]) == l) b[i]++, k--;
  }
  for (int i = 1; i <= n; i++) printf("%lld ", b[i]);
  printf("\n");
  return 0;
}
