#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int base = 19260817;
const int INF = 1e9;
const int maxn = 1e5 + 10;
const double eps = 1e-8;
inline int add(int x, int y) {
  x += y;
  return x >= mod ? x - mod : x;
}
inline int sub(int x, int y) {
  x -= y;
  return x < 0 ? x + mod : x;
}
inline int mul(int x, int y) { return 1LL * x * y % mod; }
int n, a[maxn], b[maxn];
bool mark[maxn];
long long k;
long long f(long long a, long long x) { return a - 3 * x * x + 3 * x - 1; }
int calc(int i, long long x) {
  int left = 0, right = a[i];
  while (left < right) {
    int mid = (left + right + 1) >> 1;
    if (f(a[i], mid) >= x)
      left = mid;
    else
      right = mid - 1;
  }
  return left;
}
bool check(long long x) {
  long long sum = 0;
  for (int i = 1; i <= n; i++) sum += calc(i, x);
  return sum >= k;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long left = -4e18, right = 4e18;
  while (left < right) {
    long long mid = (left + right + 1) >> 1;
    if (check(mid))
      left = mid;
    else
      right = mid - 1;
  }
  long long val = left;
  for (int i = 1; i <= n; i++) {
    int num = calc(i, val);
    if (f(a[i], num) > val)
      b[i] += num, k -= num;
    else if (f(a[i], num) == val)
      b[i] += num - 1, k -= num - 1, mark[i] = true;
  }
  for (int i = 1; i <= n; i++)
    if (mark[i]) {
      b[i]++, k--;
      if (!k) break;
    }
  for (int i = 1; i <= n; i++) cout << b[i] << " ";
  return 0;
}
