#include <bits/stdc++.h>
using namespace std;
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << "=" << h << "\n";
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << "=" << h << ",";
  _dbg(sdbg + 1, a...);
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
const int N = 100005;
int n;
long long k;
long long a[N];
long long mini[N];
long long maxi[N];
long long value[N];
void findValue(long long A, long long limit, int w) {
  long long low = 1;
  long long high = A;
  long long res = 0;
  while (low <= high) {
    long long mid = (low + high) / 2;
    long long val = mid * (A - mid * mid);
    long long lower = (mid - 1) * (A - (mid - 1) * (mid - 1));
    if (val - lower >= limit) {
      res = mid;
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  maxi[w] = res;
  low = 1;
  high = A;
  res = 0;
  while (low <= high) {
    long long mid = (low + high) / 2;
    long long val = mid * (A - mid * mid);
    long long lower = (mid - 1) * (A - (mid - 1) * (mid - 1));
    if (val - lower >= limit + 1) {
      res = mid;
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  (res);
  mini[w] = min(maxi[w], res);
  (mini[w], maxi[w]);
}
int main() {
  scanf("%d %lld", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  long long low = -(3e18);
  long long high = 1e10;
  long long res = high;
  while (low <= high) {
    long long mid = ((__int128)low + high) / 2;
    long long cntMini = 0, cntMaxi = 0;
    for (int i = 1; i <= n; i++) {
      findValue(a[i], mid, i);
      cntMini += mini[i];
      cntMaxi += maxi[i];
    }
    (mid, cntMini, cntMaxi, k);
    if (cntMini <= k && k <= cntMaxi) {
      res = mid;
      break;
    }
    if (cntMini > k) {
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    findValue(a[i], res, i);
    value[i] = mini[i];
    k -= mini[i];
  }
  for (int i = 1; i <= n; i++) {
    if (k == 0) break;
    if (maxi[i] - mini[i] <= k) {
      value[i] = maxi[i];
      k -= maxi[i] - mini[i];
    } else {
      value[i] = mini[i] + k;
      k = 0;
      break;
    }
  }
  long long f = 0;
  for (int i = 1; i <= n; i++) {
    printf("%lld ", value[i]);
    f += value[i] * (a[i] - value[i] * value[i]);
  }
  printf("\n");
  (f);
  return 0;
}
