#include <bits/stdc++.h>
using namespace std;
void print_table(int a) {
  for (long long int b = 0; b <= a; b++) {
    long long int v = (a * b) - (b * b * b);
    printf("b[%lld] = %lld\n", b, v);
  }
}
long long int contrib(int a, int b) {
  if (b <= 0) return 0;
  long long int la = a;
  long long int lb = b;
  return la - (3 * lb * lb - 3 * lb + 1);
}
long long int n, k, a[100005];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long int lo0 = -(1LL << 62LL);
  long long int hi0 = (1LL << 30LL);
  long long int best0 = -1;
  while (floor(hi0) >= floor(lo0)) {
    long long int mid0 = ((hi0 + lo0) / 2);
    if (0) {
      cout << "try criteria " << mid0 << endl;
    }
    long long int sats = 0;
    for (int i = 1; i <= n; i++) {
      int lo = 0;
      int hi = a[i];
      int best = 0;
      while (hi >= lo) {
        int mid = (hi + lo) / 2;
        if (contrib(a[i], mid) >= mid0) {
          best = mid;
          lo = mid + 1;
        } else {
          hi = mid - 1;
        }
      }
      sats += best;
    }
    if (0) {
      cout << "sats " << sats << endl;
    }
    if (sats >= k) {
      best0 = mid0;
      lo0 = mid0 + 1;
    } else {
      hi0 = mid0 - 1;
    }
  }
  long long int worst = (1LL << 60LL);
  long long int sats = 0;
  for (int i = 1; i <= n; i++) {
    int lo = 0;
    int hi = a[i];
    int best = 0;
    while (hi >= lo) {
      int mid = (hi + lo) / 2;
      if (contrib(a[i], mid) >= best0) {
        best = mid;
        lo = mid + 1;
      } else {
        hi = mid - 1;
      }
    }
    worst = min(worst, contrib(a[i], best));
    sats += best;
  }
  long long int redundants = sats - k;
  for (int i = 1; i <= n; i++) {
    int lo = 0;
    int hi = a[i];
    int best = 0;
    while (hi >= lo) {
      int mid = (hi + lo) / 2;
      if (contrib(a[i], mid) >= best0) {
        best = mid;
        lo = mid + 1;
      } else {
        hi = mid - 1;
      }
    }
    if (redundants && contrib(a[i], best) == worst) {
      redundants -= 1;
      best -= 1;
    }
    cout << best << ' ';
  }
  cout << endl;
}
