#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
const int oo = 1e9 + 7;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> before(101, 0);
  for (int i = 0; i < n; ++i) {
    int time;
    cin >> time;
    int maxnow = m - time;
    int now = 0, ind = 1;
    int ans = 0;
    while (ind <= 100) {
      if (now + ind * before[ind] <= maxnow) {
        now += ind * before[ind];
        ans += before[ind];
        ind++;
      } else {
        ans += int((maxnow - now) / ind);
        ind = 101;
      }
    }
    cout << i - ans << (i < n - 1 ? " " : "\n");
    before[time]++;
  }
  return 0;
}
