#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(NULL);
  int n;
  LL k, x;
  while (cin >> n >> k) {
    vector<LL> q;
    for (int i = 0; i < n; ++i) {
      cin >> x;
      q.push_back(x);
    }
    auto get = [](LL x, LL mx) {
      LL l = 0, r = x - 1;
      while (l <= r) {
        LL m = (l + r) >> 1;
        if (x - m * (m + 1) * 3 == mx) return make_pair(m, m + 1);
        if (x - m * (m + 1) * 3 > mx)
          l = m + 1;
        else
          r = m - 1;
      }
      return make_pair(l, l);
    };
    LL l = -3e18 - 3e8, r = 1e9;
    while (l <= r) {
      LL m = (l + r) >> 1, x = 0, y = 0;
      for (auto &i : q) {
        auto tmp = get(i, m);
        x += tmp.first;
        y += tmp.second;
      }
      if (x > k)
        l = m + 1;
      else if (y < k)
        r = m - 1;
      else {
        y -= k;
        for (auto &i : q) {
          auto tmp = get(i, m);
          if (tmp.first < tmp.second && y-- > 0) {
            cout << tmp.first << " ";
          } else {
            cout << tmp.second << " ";
          }
        }
        cout << endl;
        break;
      }
    }
  }
  return 0;
}
