#include <bits/stdc++.h>
using namespace std;
inline long long d(long long a, long long b) {
  return a - 3 * b * b + 3 * b - 1;
}
long long ans[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long low = -4e18, high = 4e18;
  while (true) {
    long long s = (low + high) / 2;
    if (low == high - 1) break;
    long long minTake = 0, maxTake = 0;
    for (int i = 0; i < n; i++) {
      long long L = -1, R = arr[i];
      if (d(arr[i], R) >= s)
        L = arr[i];
      else {
        while (true) {
          if (L == R - 1) break;
          long long S = (L + R) / 2;
          if (d(arr[i], S) < s)
            R = S;
          else
            L = S;
        }
      }
      maxTake += L;
      minTake += L;
      if (d(arr[i], L) == s) minTake--;
      ans[i] = L;
    }
    if (minTake <= k && k <= maxTake) {
      long long surplus = maxTake - k;
      for (int i = 0; i < n; i++) {
        long long L = ans[i];
        if (d(arr[i], L) != s)
          cout << L << " ";
        else {
          if (surplus > 0) {
            cout << L - 1 << " ";
            surplus--;
          } else
            cout << L << " ";
        }
      }
      return 0;
    } else if (k < minTake)
      low = s;
    else
      high = s;
  }
  assert(false);
}
