#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100004;
long long int a[MAXN];
long long int k, n;
vector<long long int> b(MAXN, 0);
long long int f(double num) {
  long long int res = 0;
  for (int i = 0; i < n; i++) {
    if (num > a[i] + 0.25) {
      b[i] = 0;
      continue;
    }
    double tem = sqrt(12 * (a[i] - num) - 3);
    b[i] = (long long int)(tem / 6 + 0.5);
    if (b[i] > a[i]) b[i] = a[i];
    res += b[i];
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  double mid;
  double lo = -3e18, hi = 1e9;
  for (int i = 0; i < 200; i++) {
    mid = (lo + hi) / 2;
    if (f(mid) >= k)
      lo = mid;
    else
      hi = mid;
  }
  long long int tot = 0;
  priority_queue<pair<long long int, int>, vector<pair<long long int, int> >,
                 greater<pair<long long int, int> > >
      pq;
  priority_queue<pair<long long int, int> > pq1;
  for (int i = 0; i < n; i++) {
    double tem = sqrt(12 * (a[i] - lo) - 3);
    b[i] = min((long long int)(tem / 6 + 0.5), a[i]);
    tot += b[i];
    if (b[i]) pq.push({a[i] - 3 * b[i] * b[i] + 3 * b[i] - 1, i});
    if (b[i] != a[i]) pq1.push({a[i] - 3 * b[i] * b[i] - 3 * b[i] - 1, i});
  }
  while (tot - k > 0) {
    pair<long long int, int> tem = pq.top();
    pq.pop();
    int i = tem.second;
    b[i]--;
    tem.first = a[i] - 3 * b[i] * b[i] + 3 * b[i] - 1;
    pq.push(tem);
    tot--;
  }
  while (tot < k) {
    pair<long long int, int> tem = pq1.top();
    pq1.pop();
    int i = tem.second;
    b[i]++;
    tem.first = a[i] - 3 * b[i] * b[i] - 3 * b[i] - 1;
    pq1.push(tem);
    tot++;
  }
  while (!(pq.empty() || pq1.empty())) {
    pair<long long int, int> tem = pq.top();
    pq.pop();
    pair<long long int, int> tem1 = pq1.top();
    pq1.pop();
    int i = tem.second, j = tem1.second;
    if (tem1.first > tem.first && i != j) {
      b[i]--;
      b[j]++;
      if (b[i] > 0) pq.push({a[i] - 3 * b[i] * b[i] + 3 * b[i] - 1, i});
      if (b[j] != a[j]) pq1.push({a[j] - 3 * b[j] * b[j] - 3 * b[j] - 1, j});
    } else
      break;
  }
  for (int i = 0; i < n; i++) {
    int bu = b[i];
    printf("%d ", bu);
  }
  return 0;
}
