#include <bits/stdc++.h>
using namespace std;
int a[200005], b[200005];
int main() {
  int n, t;
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int now = t - a[i];
    int ans = i;
    for (int j = 1; j <= 100; j++) {
      int tmp = min(b[j], now / j);
      now -= tmp * j;
      ans -= tmp;
    }
    cout << ans << endl;
    b[a[i]]++;
  }
  return 0;
}
