#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const long long mod = (119 << 23) + 1;
const long long M = 1e9 + 7;
const long long N = 1e5 + 5;
long long n, k;
long long a[N], b[N];
long long bs;
long long aux(long long i, long long m) {
  long double d = sqrtl(9.0 - 12.0 * (m + 1 - a[i]));
  long double r = (-3.0 + d) / 6.0;
  long long t = floor(r) + 1;
  if (t < 0) return 0;
  if (t > a[i]) return a[i];
  return t;
}
bool pred(long long m) {
  bs = 0;
  for (long long i = 0; i < n; ++i) bs += aux(i, m);
  return bs >= k;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(15);
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  long long lo = -3e18 - 3e9, hi = 1e9;
  long long el = INF;
  while (lo <= hi) {
    long long mid = (lo + hi) / 2;
    if (pred(mid)) {
      el = mid;
      lo = mid + 1;
    } else {
      hi = mid - 1;
    }
  }
  assert(el != INF);
  bs = 0;
  long long mn = INF;
  for (long long i = 0; i < n; ++i) {
    b[i] = aux(i, el);
    bs += b[i];
    mn = min(mn, a[i] - 3 * (b[i] - 1) * (b[i] - 1) - 3 * (b[i] - 1) - 1);
  }
  long long d = bs - k;
  for (long long i = 0; i < n; ++i) {
    if ((a[i] - 3 * (b[i] - 1) * (b[i] - 1) - 3 * (b[i] - 1) - 1) == mn && d) {
      b[i]--;
      d--;
    }
  }
  for (long long i = 0; i < n; ++i) cout << b[i] << ' ';
  cout << '\n';
}
