#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
template <typename first, typename second>
ostream& operator<<(ostream& os, const pair<first, second>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ",";
    os << *it;
  }
  return os << "]";
}
template <typename T>
ostream& operator<<(ostream& os, const multiset<T>& v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}
template <typename first, typename second>
ostream& operator<<(ostream& os, const map<first, second>& v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << it->first << " = " << it->second;
  }
  return os << "]";
}
void faltu() { cerr << '\n'; }
template <typename T>
void faltu(T a[], int n) {
  for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
  cerr << '\n';
}
template <typename T, typename... hello>
void faltu(T arg, const hello&... rest) {
  cerr << arg << ' ';
  faltu(rest...);
}
const int mx = 1e5 + 5;
long long n, k;
long long a[mx];
long long f(int idx, long long amount) {
  return a[idx] - 3LL * amount * amount + 3LL * amount - 1LL;
}
long long g(int idx, long long amount) {
  long long lo = 1, hi = a[idx], mid;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    if (f(idx, mid) <= amount)
      hi = mid - 1;
    else
      lo = mid + 1;
  }
  return min(lo, a[idx]);
}
long long ans[mx];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long lo = -4e18, hi = 4e18, mid;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    long long cnt = 0;
    for (int i = 0; i < n; ++i) cnt += g(i, mid);
    if (cnt <= k)
      hi = mid - 1;
    else
      lo = mid + 1;
  }
  priority_queue<pair<long long, long long> > pq;
  long long cnt = 0;
  for (int i = 0; i < n; ++i) {
    ans[i] = g(i, lo);
    cnt += ans[i];
    if (ans[i] < a[i]) pq.push(make_pair(f(i, ans[i] + 1), i));
  }
  while (cnt < k) {
    ++cnt;
    pair<long long, long long> p = pq.top();
    pq.pop();
    ++ans[p.second];
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  cout << '\n';
}
