#include <bits/stdc++.h>
using namespace std;
int a[100005];
pair<int, int> cal(int x, long long mx) {
  int l = 0, r = x - 1, t = 0;
  while (l <= r) {
    int m = (l + r) / 2;
    if (x - 3ll * m * (m + 1) - 1 == mx) t = 1;
    if (x - 3ll * m * (m + 1) - 1 >= mx)
      l = m + 1;
    else
      r = m - 1;
  }
  return {l - t, l};
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  long long ans = 0, k;
  cin >> n >> k;
  for (int i = (0); (i <= (n - 1)); ++i) cin >> a[i];
  long long L = -4e18, R = 4e18;
  while (L <= R) {
    long long M = (L + R) / 2, x = 0, y = 0;
    for (int i = (0); (i <= (n - 1)); ++i) {
      pair<int, int> tmp = cal(a[i], M);
      x += tmp.first, y += tmp.second;
    }
    if (x > k)
      L = M + 1;
    else if (y < k)
      R = M - 1;
    else {
      long long val = k - x;
      for (int i = (0); (i <= (n - 1)); ++i) {
        pair<int, int> tmp = cal(a[i], M);
        if (tmp.first < tmp.second && val > 0) {
          cout << tmp.second << ' ';
          val--;
        } else
          cout << tmp.first << ' ';
      }
      return 0;
    }
  }
}
