#include <bits/stdc++.h>
const long long inf = 0x3f3f3f3f;
using namespace std;
const long long maxn = 2e5 + 100;
long long a[maxn];
long long cnt[maxn];
int32_t main() {
  long long n, m;
  scanf("%lld%lld", &(n), &(m));
  for (long long i = (1); i <= (n); i++) scanf("%lld", &(a[i]));
  long long sum = 0;
  for (long long i = (1); i <= (n); i++) {
    long long x = sum + a[i] - m;
    long long ans = 0;
    if (x > 0) {
      for (long long j = (100); j >= (1); j--) {
        long long y = j * cnt[j];
        if (y >= x) {
          ans += (x + j - 1) / j;
          break;
        }
        ans += cnt[j];
        x -= y;
      }
    }
    sum += a[i];
    cnt[a[i]]++;
    printf("%lld ", ans);
  }
  return 0;
}
