#include <bits/stdc++.h>
using namespace std;
class Debugger {
 public:
  template <typename T>
  Debugger &operator<<(const T &v) {
    cerr << v;
    return *this;
  }
  ~Debugger() { cerr << endl; }
};
template <typename T1, typename T2>
inline ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T, size_t N>
inline ostream &operator<<(ostream &os, const array<T, N> &a) {
  bool first = true;
  os << "[";
  for (auto &v : a) {
    if (!first) os << ", ";
    os << v;
    first = false;
  }
  os << "]";
  return os;
}
template <typename T>
inline ostream &operator<<(ostream &os, const vector<T> &v) {
  bool first = true;
  os << "[";
  for (unsigned int i = 0; i < v.size(); i++) {
    if (!first) os << ", ";
    os << v[i];
    first = false;
  }
  return os << "]";
}
template <typename T>
inline ostream &operator<<(ostream &os, const set<T> &v) {
  bool first = true;
  os << "{";
  for (typename set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "}";
}
template <typename T1, typename T2>
inline ostream &operator<<(ostream &os, const map<T1, T2> &v) {
  bool first = true;
  os << "[";
  for (typename map<T1, T2>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "]";
}
const long long MOD = 1000000000 + 7;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, 1, -1};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long power_mod(long long x, long long y, long long p) {
  long long ans = 1;
  x %= p;
  while (y > 0) {
    if (y & 1) ans = (ans * x) % p;
    y >>= 1;
    x = (x * x) % p;
  }
  return ans;
}
inline long long modInverse(long long n, long long p) {
  return power_mod(n, p - 2, p);
}
long long nCrModP(vector<long long> &fac, long long n, long long r,
                  long long p) {
  if (r == 0) return 1;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
long long search(vector<int> &a, long long threshold, vector<int> &b) {
  long long ans = 0;
  for (int i = (0); i < (((int)(a).size())); i++) {
    if (threshold >= a[i]) {
      b[i] = 0;
      continue;
    }
    int l = 0, r = a[i];
    while (l <= r) {
      int mid = (l + r) >> 1;
      long long val = (long long)a[i] - 3LL * mid * mid + 3LL * mid - 1;
      if (val >= threshold) {
        b[i] = mid;
        l = mid + 1;
      } else {
        r = mid - 1;
      }
    }
    ans += b[i];
  }
  return ans;
}
void solve() {
  int n;
  long long k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = (0); i < (n); i++) cin >> a[i];
  long long l = -(4e18), r = 4e18;
  vector<int> b(n);
  long long threshold = -1;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    long long cnt = search(a, mid, b);
    if (cnt <= k) {
      threshold = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  long long count = search(a, threshold, b);
  vector<int> c(n);
  search(a, threshold - 1, c);
  for (int i = (0); i < (n); i++) {
    if (b[i] + 1 == c[i] && count < k) {
      b[i]++;
      count++;
    }
  }
  assert(count == k);
  for (int i = (0); i < (n); i++) {
    if (i > 0) cout << " ";
    cout << b[i];
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  srand(time(NULL));
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
