#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
using namespace std;
pair<int, int> DR8[] = {{-1, 0}, {0, 1},   {1, 0}, {0, -1},
                        {-1, 1}, {-1, -1}, {1, 1}, {1, -1}};
pair<int, int> DR4[] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0}};
const long long mod = 998244353;
long long nop = 70;
vector<int> primes(nop + 1, 1);
void sieve() {
  primes[1] = primes[0] = 0;
  for (long long i = 2; i * i <= nop; i++) {
    if (primes[i]) {
      for (long long j = i * i; j <= nop; j += i) {
        primes[j] = 0;
      }
    }
  }
}
long long gcd(long long a, long long b) {
  if (b > a) swap(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
void extgcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = a;
    y = b;
    return;
  }
  extgcd(b % a, a, x, y);
  long long y1 = y, x1 = x;
  x = y1 - (b / a) * x1;
  y = x1;
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long bexp(long long num, long long e) {
  long long ans = 1;
  while (e > 0) {
    if (e & 1) {
      ans *= num;
    }
    num *= num;
    e >>= 1;
  }
  return ans;
}
long long mexp(long long num, long long e) {
  long long ans = 1;
  while (e > 0) {
    if (e & 1) {
      ans = (ans * num) % mod;
    }
    num *= num;
    num %= mod;
    e >>= 1;
  }
  return ans % mod;
}
long long modinv(long long a) {
  a %= mod;
  return mexp(a, mod - 2);
}
long long sum(vector<long long> &poss) {
  long long ans = 0;
  for (long long i = 0; i < (poss.size()); i++) ans += poss[i];
  return ans;
}
vector<long long> check(vector<long long> &a, long long &A) {
  long long n = a.size();
  vector<long long> ans;
  for (long long i = 0; i < (n); i++) {
    long long l = 0, r = a[i];
    while (l < r) {
      long long mid = (l + r) >> 1;
      if (a[i] - 3 * mid * (mid + 1) - 1 >= A) {
        l = mid + 1;
      } else
        r = mid;
    }
    ans.push_back(l);
  }
  return ans;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) {
    cin >> a[i];
  };
  long long l = -4e18, r = 4e18;
  vector<long long> poss;
  while (l < r) {
    long long mid = (l + r + 1) >> 1;
    poss = check(a, mid);
    if (sum(poss) >= k)
      l = mid;
    else
      r = mid - 1;
  }
  poss = check(a, l);
  long long nob = 0;
  vector<long long> ans = poss;
  vector<pair<long long, long long> > pp;
  for (long long i = 0; i < (n); i++) {
    ans[i] = max(poss[i] - 1, 0LL);
    nob += ans[i];
    if (ans[i] != poss[i])
      pp.push_back({a[i] - 3 * (ans[i] + 1) * (ans[i]) - 1, i});
  }
  sort(pp.begin(), pp.end(), greater<pair<long long, long long> >());
  for (long long i = 0; i < (k - nob); i++) {
    ans[pp[i].second]++;
  }
  for (long long i = 0; i < (n); i++) {
    cout << ans[i] << " \n"[i == n - 1];
  }
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(0);
  int t = 1;
  for (long long T = 1; T <= (t); T++) {
    solve();
  }
  return 0;
}
