#include <bits/stdc++.h>
using namespace std;
int n;
long long k;
int a[100010], b[100010];
long long f(int a, int x) { return -3ll * x * x - 3ll * x + a - 1; }
int calc(int a, long long val) {
  int l = -1, r = a + 1;
  while (l + 1 < r) {
    int mid = (l + r) >> 1;
    if (f(a, mid) >= val)
      l = mid;
    else
      r = mid;
  }
  return min(a, l + 1);
}
long long sum;
bool check(long long val) {
  sum = 0;
  for (int i = 1; i <= n; i++) {
    b[i] = calc(a[i], val);
    sum += b[i];
  }
  if (sum <= k) return true;
  return false;
}
int main() {
  scanf("%d %I64d", &n, &k);
  long long l = 0, r = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    r = max(r, f(a[i], 0));
    l = min(l, f(a[i], a[i] - 1));
  }
  r++;
  l--;
  while (l + 1 < r) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  check(r);
  k -= sum;
  for (int i = 1; i <= n; i++)
    if (k > 0 && b[i] < a[i] && f(a[i], b[i]) == r - 1) {
      b[i]++;
      k--;
    }
  for (int i = 1; i <= n; i++) printf("%d ", b[i]);
  printf("\n");
  return 0;
}
