#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
using namespace std;
const int INF = 1e9;
signed main() {
  int n, m;
  cin >> n >> m;
  vector<int> t(n), ans(n);
  for (int &i : t) cin >> i;
  vector<int> cnt(101);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += t[i];
    int d = sum - m;
    int j = 100;
    int res = 0;
    while (d > 0) {
      while (cnt[j] == 0) j--;
      if (cnt[j] * j >= d) {
        res += (d - 1) / j + 1;
        d = 0;
      } else {
        res += cnt[j];
        d -= cnt[j] * j;
      }
      j--;
    }
    cnt[t[i]]++;
    ans[i] = res;
  }
  for (int i : ans) cout << i << " ";
}
