#include <bits/stdc++.h>
using namespace std;
const string NAME = "GREEXAM";
const int N = 202020;
int n, m, k, x, cnt[N];
int main() {
  ios::sync_with_stdio(0);
  fill(cnt, cnt + N, 0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    int sum = k - x, dem = 1;
    for (int j = 1; j <= 100; j++) {
      int cothedau = min(sum / j, cnt[j]);
      sum -= cothedau * j;
      dem += cothedau;
    }
    cout << i - dem << " ";
    cnt[x]++;
  }
  return 0;
}
