#include <bits/stdc++.h>
using namespace std;
const int maxn = 22;
const long long mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
using namespace std;
std::string s1, s2;
int a[1000000];
int h[10000];
int main() {
  if (fopen("../yilian.txt", "r") != NULL) {
    freopen("../yilian.txt", "r", stdin);
  } else {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
  }
  int n, m;
  while (cin >> n >> m) {
    memset(h, 0, sizeof(h));
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    int num = 0;
    for (int i = 0; i < n; i++) {
      num = 0;
      int now = a[i];
      for (int j = 1; j <= 100; j++) {
        int person = (m - now) / j;
        if (person > h[j]) {
          person = h[j];
        }
        num += person;
        now += person * j;
      }
      std::cout << i - num << " ";
      h[a[i]]++;
    }
  }
  return 0;
}
