#include <bits/stdc++.h>   using namespace std;   const long long N = 100000 + 10;   long long n, K, a[N], b[N];   struct Node {     long long v, id;   } p[N];   bool cmp(Node x, Node y) { return x.v > y.v; }   long long get(long long x, long long v) { return -3ll * (x * x + x) + v + 1; }   long long func(long long v, long long y) {     long long l = 0, r = v, mid, ret = 0;     while (l <= r) {       mid = (l + r) >> 1ll;       if (get(mid, v) >= y)         ret = mid, l = mid + 1;       else         r = mid - 1;     }     return ret;   }   long long calc(long long y) {     long long sum = 0;     for (long long i = 1; i <= n; ++i) sum += func(a[i], y);     return sum;   }   long long ans, sum;   void solve() {     long long l = -4e18, r = 1e18, mid;     while (l <= r) {       mid = (l + r) >> 1ll;       if (calc(mid) <= K)         ans = mid, r = mid - 1;       else         l = mid + 1;     }   }   signed main() {     scanf( %lld%lld , &n, &K);     for (long long i = 1; i <= n; ++i) scanf( %lld , &a[i]);     solve();     sum = 0;     for (long long i = 1; i <= n; ++i) {       b[i] = func(a[i], ans);       sum += b[i];       p[i].v = get(b[i], a[i]);       p[i].id = i;     }     sort(p + 1, p + n + 1, cmp);     for (long long i = 1; i <= n; ++i)       if (sum < K && a[p[i].id] > b[p[i].id]) sum++, b[p[i].id]++;     for (long long i = 1; i <= n; ++i) printf( %lld  , b[i]);     return 0;   }   