#include <bits/stdc++.h>
long long int max(long long int a, long long int b) { return a > b ? a : b; }
long long int min(long long int a, long long int b) { return a < b ? a : b; }
template <class T>
void print_vector(std::vector<T>& vec) {
  std::cout << "=====================================VEC======================="
               "============="
            << std::endl;
  long long int n = vec.size();
  for (long long int i = 0; i < n; i++) {
    std::cout << vec[i] << " ";
  }
  std::cout << std::endl;
  std::cout << "==============================================================="
               "============="
            << std::endl;
  return;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  long long int n, k;
  std::cin >> n >> k;
  std::vector<long long int> a(n), b(n), v(n);
  long long int low = (1e15 + 1e7), high = -(1e15 + 1e7), mid, l, r, m, total,
                A;
  for (long long int i = 0; i < n; i++) {
    std::cin >> a[i];
    low = min(low, a[i] - (3 * (a[i] - 1) * (a[i] - 1)) - (3 * (a[i] - 1)) - 1);
    high = max(high, a[i]);
  }
  long long int temp_low = low;
  while (low + 1 < high) {
    mid = low + (high - low) / 2;
    total = 0;
    for (long long int i = 0; i < n; i++) {
      if (a[i] <= mid) {
        continue;
      }
      l = 0;
      r = a[i];
      while (l + 1 < r) {
        m = l + (r - l) / 2;
        if (a[i] - 3 * m * m - 3 * m - 1 >= mid) {
          l = m;
        } else {
          r = m;
        }
      }
      total += (r);
      if (total >= k) {
        break;
      }
    }
    if (total >= k) {
      low = mid;
    } else {
      high = mid;
    }
  }
  A = low;
  total = 0;
  for (long long int i = 0; i < n; i++) {
    if (a[i] <= A) {
      b[i] = 0;
      continue;
    }
    l = 0;
    r = a[i];
    while (l + 1 < r) {
      m = l + (r - l) / 2;
      if (a[i] - 3 * m * m - 3 * m - 1 >= A) {
        l = m;
      } else {
        r = m;
      }
    }
    total += (r);
    b[i] = (r);
    v[i] = a[i] - 3 * (r - 1) * (r - 1) - 3 * (r - 1) - 1;
  }
  if (total < k) {
    std::cout << "Total is less than k" << std::endl;
    if (temp_low == A) {
      std::cout << "The initial low has been hit!" << std::endl;
    }
  }
  for (long long int i = 0; i < n && total > k; i++) {
    if (b[i] && v[i] == A) {
      b[i]--;
      total--;
    }
  }
  for (long long int i = 0; i < n; i++) {
    std::cout << b[i] << " ";
  }
  std::cout << std::endl;
  return 0;
}
