#include <bits/stdc++.h>
using namespace std;
struct subjects {
  long long int a;
  long long int calcincrease(long long int b) {
    return a - 3 * b * b - 3 * b - 1;
  }
  long long int getmax(long long int A) {
    int mn = 0, mx = a;
    while (mn < mx) {
      int mid = mn + mx + 1;
      mid >>= 1;
      if (calcincrease(mid) >= A) {
        mn = mid;
      } else {
        mx = mid - 1;
      }
    }
    return mn;
  }
};
istream& operator>>(istream& in, subjects& x) {
  cin >> x.a;
  return in;
}
template <typename T>
ostream& operator+(ostream& out, const vector<T>& vec) {
  for (const auto& x : vec) {
    out << x << " ";
  }
  out << "\n";
  return out;
}
template <typename T>
ostream& operator*(ostream& out, const vector<T>& vec) {
  for (const auto& x : vec) {
    out + x;
  }
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& vec) {
  for (auto& x : vec) {
    in >> x;
  }
  return in;
}
void solve() {
  long long int n, k;
  cin >> n >> k;
  vector<subjects> type(n);
  cin >> type;
  long long int mn = -4e18;
  long long int mx = 4e18;
  while (mn < mx) {
    long long int mid = mn + mx + 1;
    mid >>= 1;
    long long int mink = 0;
    long long int maxk = 0;
    vector<bool> iscurr(n);
    vector<long long int> ans(n);
    for (int i = 0; i < n; i++) {
      long long int x = type[i].getmax(mid);
      long long int y = type[i].getmax(mid + 1);
      if (x != y) {
        assert((x - y) == 1);
        iscurr[i] = 1;
      }
      ans[i] = y;
      mink += y;
      maxk += x;
    }
    assert(mink <= maxk);
    if (mink <= k && k <= maxk) {
      long long int needed = k - mink;
      for (int i = 0; i < n; i++) {
        if (needed && iscurr[i]) {
          cout << ans[i] + 1 << " ";
          --needed;
        } else {
          cout << ans[i] << " ";
        }
      }
      return;
    }
    if (k > maxk) {
      mx = mid - 1;
    } else {
      mn = mid;
    }
  }
  cout << "-1\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}
