#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int maxn = 2e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n;
ll k, arr[maxn];
bool chk(ll bound, bool print) {
  ll need = k;
  vector<ll> ans(n + 1);
  vector<int> additional;
  for (int i = 1; i <= n; i++) {
    ll lo = 0, hi = arr[i];
    while (lo < hi) {
      ll mid = (lo + hi + 1) / 2;
      ll change = 0;
      if (mid == 0) {
        change = 0;
      } else {
        change = arr[i] - 3 * mid * mid + 3 * mid - 1;
      }
      if (change >= bound) {
        lo = mid;
      } else {
        hi = mid - 1;
      }
    }
    ans[i] = lo;
    need -= ans[i];
    if (need <= 0 && !print) {
      return true;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (need < 0 && (arr[i] - 3 * ans[i] * ans[i] + 3 * ans[i] - 1) == bound) {
      ++need;
      --ans[i];
    }
  }
  if (print) {
    for (int i = 1; i <= n; i++) {
      cout << ans[i] << " ";
    }
    cout << "\n";
  }
  return need == 0;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  ll lo = -4e18, hi = 4e18;
  while (lo < hi) {
    ll mid = (lo + hi + 1) / 2;
    if (chk(mid, false)) {
      lo = mid;
    } else {
      hi = mid - 1;
    }
  }
  assert(!chk(lo + 1, false));
  chk(lo, true);
  return 0;
}
