#include <bits/stdc++.h>
using namespace std;
mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
template <typename T>
inline void chkmax(T &x, T y) {
  if (x < y) x = y;
}
template <typename T>
inline void chkmin(T &x, T y) {
  if (x > y) x = y;
}
inline int read() {
  int x = 0;
  char c = getchar();
  while (c < 48) c = getchar();
  while (c > 47) x = x * 10 + (c ^ 48), c = getchar();
  return x;
}
const int maxn = 1e5 + 10;
long long k;
int n, A[maxn], B[maxn];
long long getval(int i, int x) { return A[i] - 3ll * x * x + 3ll * x - 1; }
long long check(long long val) {
  long long sum = 0;
  for (int i = (1), iend = (n); i <= iend; ++i) {
    int l = 1, r = A[i], mid, res = 0;
    while (l <= r) {
      mid = (l + r) >> 1;
      getval(i, mid) >= val ? l = (res = mid) + 1 : r = mid - 1;
    }
    B[i] = res, sum += res;
  }
  return sum;
}
struct cmp {
  bool operator()(int x, int y) {
    return getval(x, B[x] + 1) < getval(y, B[y] + 1);
  }
};
void solve() {
  cin >> n >> k;
  for (int i = (1), iend = (n); i <= iend; ++i) A[i] = read();
  long long l = -4e18, r = 1e18, mid;
  while (l < r) {
    mid = (l + r) >> 1;
    check(mid) <= k ? r = mid : l = mid + 1;
  }
  long long sum = check(l);
  priority_queue<int, vector<int>, cmp> Q;
  for (int i = (1), iend = (n); i <= iend; ++i) {
    if (B[i] < A[i]) Q.push(i);
  }
  while (sum < k) {
    int i = Q.top();
    Q.pop(), sum++, B[i]++;
    if (B[i] < A[i]) Q.push(i);
  }
  for (int i = (1), iend = (n); i <= iend; ++i) printf("%d ", B[i]);
}
int main() {
  solve();
  return 0;
}
