#include <bits/stdc++.h>
void err() { std::cout << std::endl; }
template <typename T, typename... Args>
void err(T a, Args... args) {
  std::cout << a << ' ';
  err(args...);
}
template <template <typename...> class T, typename t, typename... A>
void err(const T<t> &arg, const A &...args) {
  for (auto &v : arg) std::cout << v << ' ';
  err(args...);
}
using namespace std;
const int N = 1e5 + 5;
long long n, k;
int a[N], b[N];
bool chk(long long A) {
  long long s = 0;
  for (int i = 1; i <= n; i++) {
    int l = 0, r = a[i] + 1, mid;
    while (l < r) {
      mid = (l + r) >> 1;
      if (a[i] - 3ll * mid * (mid - 1) - 1 >= A)
        l = mid + 1;
      else
        r = mid;
    }
    b[i] = l - 1;
    s += b[i];
  }
  return s >= k;
}
void run() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long l = -8e18, r = 8e18, mid;
  while (l < r) {
    mid = (l + r) >> 1;
    if (chk(mid)) {
      l = mid + 1;
    } else {
      r = mid;
    }
  }
  long long A = l - 1, R = 0;
  chk(A);
  for (int i = 1; i <= n; i++) R += b[i];
  R -= k;
  for (int i = 1; i <= n && R; i++) {
    if (b[i] && a[i] - 3ll * b[i] * (b[i] - 1) - 1 == A) {
      --b[i], --R;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << b[i] << " \n"[i == n];
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(20);
  run();
  return 0;
}
