#include <bits/stdc++.h>
using namespace std;
int b[110];
int main() {
  int n, c = 0, m;
  cin >> n >> m;
  int a[n + 1];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int rem = m - a[i], ans = i;
    for (int j = 1; j < 110; j++) {
      int temp = min(b[j], rem / j);
      ans -= temp;
      rem -= j * temp;
    }
    cout << ans << " ";
    b[a[i]]++;
  }
  return 0;
}
