#include <bits/stdc++.h>
using namespace std;
template <typename T>
void _dbg(const char* _s, T _h) {
  cerr << _s << " = " << _h << "\n";
}
template <typename T, typename... Ts>
void _dbg(const char* _s, T _h, Ts... _t) {
  int _b = 0;
  while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',') cerr << *_s++;
  cerr << " = " << _h << ",";
  _dbg(_s + 1, _t...);
}
int main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int pref = 0;
  vector<int> cnt(101, 0);
  for (int i = 0; i < n; ++i) {
    int cur;
    cin >> cur;
    pref += cur;
    if (pref <= m) {
      cout << "0 ";
      cnt[cur]++;
      continue;
    }
    int res = 0;
    int k = 100;
    int tmp = pref;
    while (tmp - cnt[k] * k > m) {
      res += cnt[k];
      tmp -= cnt[k] * k;
      --k;
    }
    res += (tmp - m + k - 1) / k;
    cout << res << ' ';
    cnt[cur]++;
  }
}
