#include <bits/stdc++.h>
using namespace std;
inline int nxt() {
  int x;
  scanf("%d", &x);
  return x;
}
using ld = long double;
int main() {
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int n = nxt();
  long long k;
  scanf("%lld", &k);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    a[i] = nxt();
  }
  ld r = 0;
  ld l = 0;
  for (int i = 0; i < n; ++i) {
    r = max<ld>(r, a[i]);
    l = min<ld>(l, a[i] - 3ll * a[i] * a[i]);
  }
  for (int it = 0; it < 300; ++it) {
    ld m = (l + r) / 2;
    ld sum = 0;
    for (int i = 0; i < n; ++i) {
      if (m > a[i]) {
        continue;
      }
      if (m < a[i] - 3ll * a[i] * a[i]) {
        sum += a[i];
        continue;
      }
      sum += sqrtl((a[i] - m) / 3);
    }
    if (sum >= k) {
      l = m;
    } else {
      r = m;
    }
  }
  vector<int> b(n);
  vector<pair<long long, int>> can;
  ld m = (l + r) / 2;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    if (m > a[i]) {
      continue;
    }
    if (m < a[i] - 3ll * a[i] * a[i]) {
      k -= a[i];
      b[i] = a[i];
      ans += 1ll * b[i] * (a[i] - 1ll * b[i] * b[i]);
      continue;
    }
    b[i] = sqrtl((a[i] - m) / 3);
    k -= b[i];
    ans += 1ll * b[i] * (a[i] - 1ll * b[i] * b[i]);
    if (b[i] < a[i]) {
      can.push_back({1ll * (b[i] + 1) * (a[i] - 1ll * (b[i] + 1) * (b[i] + 1)) -
                         1ll * b[i] * (a[i] - 1ll * b[i] * b[i]),
                     i});
    }
  }
  sort((can).begin(), (can).end());
  while (k) {
    ans += can.back().first;
    b[can.back().second] += 1;
    can.pop_back();
    --k;
  }
  cerr << ans << "\n";
  for (int x : b) {
    cout << x << " ";
  }
  cout << "\n";
  return 0;
}
