#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long mult(long long a, long long b, long long p = MOD) {
  return ((a % p) * (b % p)) % p;
}
long long add(long long a, long long b, long long p = MOD) {
  return (a % p + b % p) % p;
}
int val[1020000];
int cant[1020000];
int main() {
  int n, M;
  cin >> n >> M;
  memset(cant, 0, sizeof cant);
  for (long long i = 0; i < n; i++) {
    cin >> val[i];
    int M2 = M - val[i];
    int tot, tote;
    tot = tote = 0;
    for (long long j = 1; j < 101; j++) {
      if (tot + cant[j] * j > M2) {
        tote += (M2 - tot) / (j);
        break;
      } else {
        tote += cant[j];
        tot += cant[j] * j;
      }
    }
    cout << i - tote << " ";
    cant[val[i]]++;
  }
}
