#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], b[N];
long long n, k;
bool check(long long y) {
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    int l = 0, r = a[i], mid;
    while (l < r) {
      mid = (l + r + 1) >> 1;
      if (a[i] - 3ll * mid * (mid - 1) - 1 >= y)
        l = mid;
      else
        r = mid - 1;
    }
    b[i] = l;
    res += b[i];
  }
  return res >= k;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  long long l = -4e18, r = 4e18, mid;
  while (l < r) {
    mid = (l + r + 1) >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  long long res = 0;
  check(l);
  for (int i = 1; i <= n; i++) res += b[i];
  res -= k;
  for (int i = 1; i <= n && res; i++) {
    if (b[i] && (a[i] - 3ll * b[i] * (b[i] - 1) - 1 == l)) b[i]--, res--;
  }
  for (int i = 1; i <= n; i++) printf("%d ", b[i]);
  printf("\n");
}
