#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long INF = 1e9;
const long long INFLL = 4e18;
const int MAX_N = 100000;
int N;
long long K;
long long arr[MAX_N + 1];
pair<long long, long long> calc(long long x) {
  pair<long long, long long> p = {0LL, 0LL};
  for (int i = 1; i <= N; i++) {
    if (arr[i] < x) continue;
    if (arr[i] == x) {
      p.second++;
      continue;
    }
    long long bs = 0, be = INF, bm;
    while (bs < be) {
      bm = (bs + be) / 2LL + 1LL;
      long long t = arr[i] - 3LL * bm * bm - 3LL * bm - 1LL;
      if (t >= x) {
        bs = bm;
      } else {
        be = bm - 1LL;
      }
    }
    if (bs + 1LL > arr[i]) {
      p.first += arr[i];
      p.second += arr[i];
      continue;
    }
    p.first += bs + 1LL;
    p.second += bs + 1LL;
    if (arr[i] - 3LL * bs * bs - 3LL * bs - 1LL == x) {
      p.first -= 1LL;
    }
  }
  return p;
}
int main() {
  scanf("%d%lld", &N, &K);
  for (int i = 1; i <= N; i++) {
    scanf("%lld", &arr[i]);
  }
  long long s = 0, e = INFLL + INF, m;
  long long c1 = 0, c2 = 0;
  while (s < e) {
    m = (s + e) / 2 - INFLL;
    pair<long long, long long> p = calc(m);
    if (0) cout << m << " " << p.first << " " << p.second << endl;
    c1 = p.first;
    c2 = p.second;
    if (c1 <= K && K <= c2) {
      s = e = m + INFLL;
      break;
    } else if (c2 < K) {
      e = m + INFLL - 1LL;
    } else {
      s = m + INFLL + 1LL;
    }
  }
  s -= INFLL;
  pair<long long, long long> p = calc(s);
  long long t = K - p.first;
  for (int i = 1; i <= N; i++) {
    if (arr[i] < s) {
      printf("0 ");
      continue;
    }
    if (arr[i] == s) {
      if (t > 0) {
        printf("1 ");
        t--;
      } else {
        printf("0 ");
      }
      continue;
    }
    long long bs = 0, be = INF, bm;
    while (bs < be) {
      bm = (bs + be) / 2LL + 1LL;
      long long t = arr[i] - 3LL * bm * bm - 3LL * bm - 1LL;
      if (t >= s) {
        bs = bm;
      } else {
        be = bm - 1LL;
      }
    }
    if (bs + 1LL > arr[i]) {
      printf("%lld ", arr[i]);
      continue;
    }
    if (arr[i] - 3LL * bs * bs - 3LL * bs - 1LL == s) {
      if (t > 0) {
        printf("%lld ", bs + 1LL);
        t--;
      } else {
        printf("%lld ", bs);
      }
    } else {
      printf("%lld ", bs + 1LL);
    }
  }
  return 0;
}
