#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool cmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool cmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
const int _ = 1e5 + 55;
int N;
long long K;
long long a[_], res[_];
inline long long f(long long a, long long x) {
  return a - 3 * x * x + 3 * x - 1;
}
inline long long calc(long long a, long long b, long long c) {
  if ((long double)b * b - (long double)4 * a * c < 0) return 0;
  return max(
      0ll,
      (long long)((-b + sqrt((long double)b * b - (long double)4 * a * c)) /
                  (a * 2)));
}
inline long long get(long long s) {
  long long sum(0);
  for (int i(1), I(N); i <= I; ++i) sum += min(calc(3, -3, 1 + s - a[i]), a[i]);
  return sum;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> N >> K;
  long long l(1e18), r(-1e18), mid, ans;
  for (int i(1), I(N); i <= I; ++i)
    cin >> a[i], cmin(l, f(a[i], a[i])), cmax(r, f(a[i], 0));
  while (l <= r) {
    mid = (l + r) >> 1;
    if (get(mid) >= K)
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  long long sum(get(ans));
  for (int i(1), I(N); i <= I; ++i) {
    res[i] = min(calc(3, -3, 1 + ans - a[i]), a[i]);
    if (f(a[i], res[i]) == ans && res[i] > 0 && sum > K) --sum, --res[i];
  }
  for (int i(1), I(N); i <= I; ++i) printf("%lld ", res[i]);
  return 0;
}
