#include <bits/stdc++.h>
using namespace std;
int n, m, t, cnt[110];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    int now = m - t;
    int ans = i;
    for (int j = 1; j <= 100; j++) {
      int g = min(now / j, cnt[j]);
      now -= g * j;
      ans -= g;
    }
    cnt[t]++;
    cout << ans << " ";
  }
  cout << endl;
  return 0;
}
