#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,fma")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
using namespace std;
const long long mod = 1e9 + 7, mod2 = 998244353;
const long double eps = 1e-6;
const long long inf = 1e18;
const int base = 1e9;
const long double PI = 3.1415926;
void deb(long double first){};
int n, a[100 * 1000];
long long k;
unsigned int bitcount(unsigned long long val) {
  return __builtin_popcount(val) + __builtin_popcount(val >> 32);
}
void local() { freopen("test.in", "r", stdin); }
void remote() {}
void read() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
}
long long cnt(long long bound, vector<int> &v) {
  long long res = 0;
  for (int i = 0; i < n; i++) {
    int l = 0, r = a[i] + 1;
    while (r - l > 1) {
      int m = (r + l) / 2;
      if (a[i] - 3 * 1ll * m * (m - 1) - 1 >= bound)
        l = m;
      else
        r = m;
    }
    v[i] = l;
    res += l;
  }
  return res;
}
int main() {
  remote();
  read();
  vector<int> v(n);
  long long l = -4e18, r = 4e18;
  while (l < r) {
    long long m = l + (r - l) / 2;
    long long val = cnt(m, v);
    if (val > k) {
      l = m + 1;
    } else
      r = m;
  }
  long long val = cnt(l, v);
  vector<int> res = v;
  long long val2 = cnt(l - 1, v);
  for (int i = 0; i < n; i++)
    if (v[i] == res[i] + 1 && val < k) res[i]++, val++;
  for (int i = 0; i < n; i++) cout << res[i] << " ";
}
