#include <bits/stdc++.h>
using namespace std;
char buff[200];
template <typename T>
void read(T& o) {
  scanf("%s", buff);
  T f = 1;
  int i = 0;
  if (buff[0] == '-') i++, f = -1;
  for (; buff[i]; ++i) {
    o *= 10, o += buff[i] - '0';
  }
  o *= f;
}
template <typename T>
void write(T o) {
  int len = 0;
  buff[0] = '0';
  if (o == 0) {
    putchar('0');
    return;
  }
  int f = 1;
  if (o < 0) f = -1;
  o *= f;
  for (; o; o /= 10) buff[len++] = o % 10 + '0';
  if (f == -1) buff[len++] = '-';
  reverse(buff, buff + len);
  buff[len++] = '\0';
  printf("%s", buff);
}
const int maxn = 100000 + 10;
const __int128 inf = (__int128)1 << 122;
__int128 k;
__int128 a[maxn];
int n;
__int128 ans[maxn];
int id[maxn];
inline __int128 f(int i, __int128 ff) {
  __int128 l, r;
  l = 0, r = a[i];
  while (l < r) {
    __int128 mid = r - (r - l + 1) / 2;
    if (a[i] - 3LL * mid * mid - 3LL * mid - 1 >= ff)
      l = mid + 1;
    else
      r = mid;
  }
  return l;
}
inline int judge(__int128 mid) {
  __int128 c = 0;
  for (auto i = (0); i < (n); ++i) {
    ans[i] = f(i, mid);
    c += ans[i];
  }
  return c >= k;
}
inline __int128 calc(int l) {
  return -a[l] + 3 * ans[l] * ans[l] - 3 * ans[l] + 1;
}
int main(void) {
  scanf("%d", &(n)), read(k);
  for (auto i = (0); i < (n); ++i) read(a[i]), id[i] = i;
  __int128 l, r;
  r = inf;
  l = -inf;
  while (l < r) {
    __int128 mid = l + (r - l + 1) / 2;
    if (judge(mid))
      l = mid;
    else
      r = mid - 1;
  }
  __int128 tmp = 0;
  for (auto i = (0); i < (n); ++i) {
    ans[i] = f(i, l);
    tmp += ans[i];
  }
  sort(id, id + n, [](const int& l, const int& r) {
    if (calc(l) != calc(r)) return calc(l) > calc(r);
    return l < r;
  });
  assert(tmp - k < n);
  tmp -= k;
  for (int i = 0; i < n && tmp > 0; ++i) {
    if (ans[id[i]] != 0) {
      tmp--;
      ans[id[i]]--;
    }
  }
  for (auto i = (0); i < (n); ++i) {
    write(ans[i]);
    printf(" ");
  }
  puts("");
  return 0;
}
