#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926536;
const long long prime = 1e9 + 7;
const long long inf = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, t;
  cin >> n >> m;
  vector<long long> cnt(101, 0);
  for (long long i = (long long)(1); i <= (long long)(n); i++) {
    cin >> t;
    long long left = m - t, used = 0;
    for (long long j = (long long)(1); j <= (long long)(100); j++) {
      if (left < j) {
        break;
      }
      if (cnt[j] == 0) {
        continue;
      }
      used += min(left / j, cnt[j]);
      left -= min(left / j, cnt[j]) * j;
    }
    cout << i - used - 1 << " ";
    cnt[t]++;
  }
  return 0;
}
