#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long nega = 1;
  while (!isdigit(ch)) {
    if (ch == '-') nega = -1;
    ch = getchar();
  }
  long long ans = 0;
  while (isdigit(ch)) {
    ans = ans * 10 + ch - 48;
    ch = getchar();
  }
  if (nega == -1) return -ans;
  return ans;
}
inline long long min(long long x, long long y, long long z) {
  return min(x, min(y, z));
}
inline long long max(long long x, long long y, long long z) {
  return max(x, max(y, z));
}
inline long long add(long long x, long long y) {
  return x + y >= 998244353 ? x + y - 998244353 : x + y;
}
inline long long add(long long x, long long y, long long z) {
  return add(add(x, y), z);
}
inline long long sub(long long x, long long y) {
  return x - y < 0 ? x - y + 998244353 : x - y;
}
inline long long mul(long long x, long long y) {
  return 1LL * x * y % 998244353;
}
inline long long mul(long long x, long long y, long long z) {
  return mul(mul(x, y), z);
}
long long n, k, a[100005], b[100005];
struct Node {
  long long id, dat;
  Node(long long id = 0, long long dat = 0) : id(id), dat(dat){};
};
Node c[100005];
bool cmp(Node x, Node y) { return x.dat > y.dat; }
bool judge(long long x) {
  long long sum = 0;
  for (long long i = 1; i <= n; i++) {
    long long l = 0, r = a[i];
    while (l <= r) {
      long long mid = (l + r) / 2;
      long long A = mid * (a[i] - mid * mid);
      long long B = (mid - 1) * (a[i] - (mid - 1) * (mid - 1));
      if (A - B >= x)
        l = mid + 1;
      else
        r = mid - 1;
    }
    b[i] = r, sum += r;
  }
  return sum >= k;
}
signed main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) a[i] = read();
  long long l = -0x3f3f3f3f3f3f3f3f, r = 0x3f3f3f3f3f3f3f3f;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (judge(mid))
      l = mid + 1;
    else
      r = mid - 1;
  }
  judge(r);
  long long sum = 0, cnt = 0;
  for (long long i = 1; i <= n; i++) {
    sum += b[i];
    if (!b[i]) continue;
    long long A = b[i] * (a[i] - b[i] * b[i]);
    long long B = (b[i] - 1) * (a[i] - (b[i] - 1) * (b[i] - 1));
    c[++cnt] = Node(i, B - A);
  }
  sum -= k;
  sort(c + 1, c + cnt + 1, cmp);
  for (long long i = 1; i <= sum; i++) b[c[i].id]--;
  for (long long i = 1; i <= n; i++) printf("%lld ", b[i]);
  return 0;
}
