#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, m, a[N], cnt[N], sum[N];
inline int read() {
  int f = 1, x = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
  return f * x;
}
int cha, ans, t;
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    sum[i] = sum[i - 1] + a[i];
  }
  for (int i = 1; i <= n; i++) {
    if (sum[i] <= m)
      cout << 0 << " ";
    else {
      cha = sum[i] - m;
      ans = 0;
      for (int j = 100; j >= 1; j--) {
        t = min(cnt[j], (cha + j - 1) / j);
        cha -= t * j;
        ans += t;
        if (cha <= 0) break;
      }
      cout << ans << " ";
    }
    cnt[a[i]]++;
  }
  return 0;
}
