#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long a[N], n, k, b[N];
inline long long read() {
  long long x = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * ff;
}
inline long long work(int s, long long x) {
  if (x > a[s] - 1) return 0;
  long long p = a[s] - 1;
  if (x <= -3 * p * p - 3 * p - 1 + a[s]) return a[s];
  long long l = 0, r = a[s] - 1;
  while (l < r) {
    long long mid = l + r + 1 >> 1;
    if (-3 * mid * mid - 3 * mid - 1 + a[s] >= x)
      l = mid;
    else
      r = mid - 1;
  }
  return l + 1;
}
inline bool check(long long mid) {
  long long sum = 0;
  for (register int i = 1; i <= n; ++i) sum += work(i, mid);
  if (sum >= k) return true;
  return false;
}
int main() {
  n = read();
  k = read();
  for (register int i = 1; i <= n; ++i) a[i] = read();
  long long l = -8e18, r = 8e18;
  while (l < r) {
    long long mid = l + r + 1 >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  long long sum = 0;
  for (register int i = 1; i <= n; ++i) b[i] = work(i, l), sum += b[i];
  sum -= k;
  for (int i = 1; i <= n && sum; ++i) {
    if (b[i] && -3 * (b[i] - 1) * (b[i] - 1) - 3 * (b[i] - 1) - 1 + a[i] == l)
      --b[i], --sum;
  }
  for (register int i = 1; i <= n; ++i) printf("%lld ", b[i]);
  return (0 ^ 0 ^ 0);
}
