#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n, m;
  cin >> n >> m;
  int t[n];
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  int cnt[101] = {}, res = 0;
  for (int i = 0; i < n; i++) {
    int now = 0, sum = t[i];
    for (int j = 1; j <= 100; j++) {
      int here = min((m - sum) / j, cnt[j]);
      sum += here * j;
      now += here;
    }
    cnt[t[i]]++;
    cout << i - now << " ";
  }
}
