#include <bits/stdc++.h>
using namespace std;
template <typename T>
T read() {
  T x = 0, sgn = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') sgn = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
  return x * sgn;
}
const int N = 1e5 + 10;
const long long inf = 0x3f3f3f3f3f3f3f3f;
int a[N], b[N], n;
long long k, s;
long long f(int x, long long y) {
  if (x == y) return inf;
  return x - 3 * y * (y - 1) - 1;
}
int cal(int p, long long lim) {
  int l = 1, r = a[p] - 1, ans = a[p];
  while (l <= r) {
    long long mid = l + r >> 1;
    if (f(a[p], mid) > lim)
      l = mid + 1;
    else
      r = mid - 1, ans = mid;
  }
  return ans;
}
bool check(long long mid) {
  s = 0;
  for (int i = 1; i <= n; i++) {
    int p = cal(i, mid);
    b[i] = p;
    s += p;
  }
  return s < k;
}
int main() {
  n = read<int>();
  k = read<long long>();
  for (int i = 1; i <= n; i++) a[i] = read<int>();
  long long l = inf, r = 0;
  for (int i = 1; i <= n; i++)
    l = min(l, f(a[i], a[i] - 1)), r = max(r, f(a[i], 0));
  long long ans = r;
  while (l <= r) {
    long long mid = l + r >> 1;
    if (check(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  ans = l;
  check(ans);
  k -= s;
  for (int i = 1; i <= n; i++)
    while (k > 0 && b[i] < a[i] && f(a[i], b[i]) == ans) b[i]++, k--;
  for (int i = 1; i <= n; i++) printf("%d%c", b[i], " \n"[i == n]);
  return 0;
}
