#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
template <class T>
T gcd(T a, T b) {
  return !b ? a : gcd(b, a % b);
}
template <class T>
inline void umin(T &x, T y) {
  x = x < y ? x : y;
}
template <class T>
inline void umax(T &x, T y) {
  x = x > y ? x : y;
}
mt19937 R(chrono::system_clock().now().time_since_epoch().count());
const int N = 666666;
int n, a[N], x[N];
long long k;
long long calc(int i, long long x) { return a[i] - 3 * x * x + 3 * x - 1; }
long long calc(long long lim) {
  long long res = 0;
  for (register int i = (1); i <= (n); i++) {
    int l = 0, r = a[i];
    while (l < r) {
      int mid = (l + r + 1) / 2;
      if (calc(i, mid) >= lim)
        l = mid;
      else
        r = mid - 1;
    }
    res += l;
    x[i] = l;
  }
  return res;
}
int main() {
  read(n);
  read(k);
  for (register int i = (1); i <= (n); i++) read(a[i]);
  long long l = -4e18, r = 4e9;
  while (l < r) {
    long long mid = (l + r) / 2;
    if (l + 1 == r) mid = l;
    if (calc(mid) <= k)
      r = mid;
    else
      l = mid + 1;
  }
  long long need = k - calc(l);
  for (register int i = (1); i <= (n); i++)
    if (need && x[i] + 1 <= a[i] && calc(i, x[i] + 1) == l - 1) x[i]++, need--;
  for (register int i = (1); i <= (n); i++) printf("%d ", x[i]);
  return 0;
}
