#include <bits/stdc++.h>
const int MAXN = 3e5 + 10;
const double eps = 1e-8;
const int mod = 1e9 + 9;
using namespace std;
struct edge {
  int t, v;
  edge *next;
} e[MAXN << 1], *h[MAXN], *o = e;
void add(int x, int y, int vul) {
  o->t = y;
  o->v = vul;
  o->next = h[x];
  h[x] = o++;
}
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
int n;
long long k;
int a[MAXN], b[MAXN];
long long check(long long x) {
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    long long l = 1;
    long long r = a[i];
    long long ans = 0;
    while (l <= r) {
      long long mid = (l + r) >> 1;
      if (a[i] - 3ll * mid * mid + 3ll * mid - 1 >= x)
        ans = mid, l = mid + 1;
      else
        r = mid - 1;
    }
    sum += ans;
    b[i] = ans;
  }
  return sum;
}
set<pair<long long, int> > s;
int main() {
  n = read();
  k = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  long long t = 3e18 + 1;
  long long l = 1;
  long long r = 1e9 + t;
  long long ans = 0;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid - t) <= k)
      ans = mid - t, r = mid - 1;
    else
      l = mid + 1;
  }
  long long p = check(ans);
  k -= p;
  for (int i = 1; i <= n; i++)
    if (b[i] < a[i])
      s.insert(make_pair(
          a[i] - 3ll * (b[i] + 1) * (b[i] + 1) + 3ll * (b[i] + 1) - 1, i));
  for (int i = 1; i <= k; i++) {
    auto ite = s.end();
    ite--;
    int x = (*ite).second;
    b[x]++;
    s.erase(ite);
    if (b[x] < a[x])
      s.insert(make_pair(
          a[x] - 3ll * (b[x] + 1) * (b[x] + 1) + 3ll * (b[x] + 1) - 1, x));
  }
  for (int i = 1; i <= n; i++) printf("%d ", b[i]);
  printf("\n");
  return 0;
}
