#include <bits/stdc++.h>
using namespace std;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &x : v) is >> x;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (long long i = 0; i < v.size(); i++) {
    cout << v[i];
    if (i != v.size() - 1) cout << endl;
  };
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  cout << '(' << p.first << ',' << p.second << ')';
  return os;
}
template <typename T>
void Out(T x) {
  cout << x << endl;
}
template <typename T1, typename T2>
void Ans(bool first, T1 y, T2 n) {
  if (first)
    Out(y);
  else
    Out(n);
}
using vec = vector<long long>;
using mat = vector<vec>;
using Pii = pair<long long, long long>;
using PiP = pair<long long, Pii>;
using PPi = pair<Pii, long long>;
using Pdi = pair<double, long long>;
using bools = vector<bool>;
using pairs = vector<Pii>;
const long long mod = 1000000007;
long long df(long long a, long long b) {
  if (b == a) return -4000000000000000000;
  return a - 3 * b * b - 3 * b - 1;
}
signed main() {
  long long n, k;
  cin >> n >> k;
  vec a(n);
  cin >> a;
  vec ans0(n), ans1(n);
  long long d0 = -4000000000000000000, d1 = 4000000000000000000;
  while (d1 - d0 > 1) {
    long long d = (d0 + d1) / 2;
    long long cnt = 0;
    for (long long i = (0); i < (n); i++) {
      long long b0 = -1, b1 = a[i];
      while (b1 - b0 > 1) {
        long long b = (b0 + b1) / 2;
        if (df(a[i], b) < d)
          b1 = b;
        else
          b0 = b;
      }
      cnt += b1;
    }
    if (cnt >= k)
      d0 = d;
    else
      d1 = d;
  }
  for (long long i = (0); i < (n); i++) {
    long long b0 = -1, b1 = a[i];
    while (b1 - b0 > 1) {
      long long b = (b0 + b1) / 2;
      if (df(a[i], b) < d0)
        b1 = b;
      else
        b0 = b;
    }
    ans0[i] = b1;
    b0 = -1, b1 = a[i];
    while (b1 - b0 > 1) {
      long long b = (b0 + b1) / 2;
      if (df(a[i], b) < d1)
        b1 = b;
      else
        b0 = b;
    }
    ans1[i] = b1;
  }
  long long S = 0;
  for (long long i = (0); i < (n); i++) S += ans1[i];
  for (long long i = (0); i < (n); i++) {
    long long d = min(k - S, ans0[i] - ans1[i]);
    ans1[i] += d;
    S += d;
  }
  for (long long i = (0); i < (n); i++) cout << ans1[i] << " ";
  cout << endl;
  return 0;
}
