#include <bits/stdc++.h>
using namespace std;
void __dump(int x) { cout << x; }
void __dump(long long x) { cout << x; }
void __dump(long double x) { cout << fixed << setprecision(3) << x; }
void __dump(char x) { cout << '\'' << x << '\''; }
void __dump(const string &x) { cout << '"' << x << '"'; }
void __dump(const char *x) { cout << '"' << x << '"'; }
void __dump(bool x) { cout << (x ? "true" : "false"); }
void _dump() { cout << "\n"; }
template <typename T, typename U>
void __dump(const pair<T, U> &x) {
  cout << '{';
  __dump(x.first);
  cout << ',';
  __dump(x.second);
  cout << '}';
}
template <typename T, typename U, typename V>
void __dump(const tuple<T, U, V> &x) {
  cout << '{';
  __dump(get<0>(x));
  cout << ',';
  __dump(get<1>(x));
  cout << ',';
  __dump(get<2>(x));
  cout << '}';
}
template <typename T>
void __dump(const T &x) {
  int f = 0;
  cout << '{';
  for (auto &i : x) cout << (f++ ? "," : ""), __dump(i);
  cout << "}";
}
template <typename T, typename... U>
void _dump(T t, U... u) {
  __dump(t);
  if (sizeof...(u)) cout << ", ";
  _dump(u...);
}
const int N = 1e5;
const long long INFLL = 4e18L;
int n;
long long k;
int a[N + 2], b[N + 2];
int getNb(int i, long long mn) {
  int nb = 0;
  int lo = 1, hi = a[i];
  while (lo <= hi) {
    int mid = lo + (hi - lo) / 2;
    if (a[i] - 3LL * mid * (mid + 1) - 1 >= mn)
      nb = mid, lo = mid + 1;
    else
      hi = mid - 1;
  }
  return nb;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  long long ans;
  long long lo = -INFLL, hi = INFLL;
  while (lo <= hi) {
    long long mid = lo + (hi - lo) / 2;
    long long nb = 0;
    for (int i = 1; i <= n; ++i) nb += getNb(i, mid);
    if (nb >= k)
      ans = mid, lo = mid + 1;
    else
      hi = mid - 1;
  }
  for (int i = 1; i <= n; ++i) b[i] = getNb(i, ans);
  k -= accumulate(b + 1, b + n + 1, 0LL);
  for (int i = 1; i <= n; ++i)
    if (k < 0 && a[i] - 3LL * b[i] * (b[i] + 1) - 1 == ans) ++k, --b[i];
  assert(k == 0);
  for (int i = 1; i <= n; ++i) cout << b[i] << " ";
  cout << '\n';
}
