#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool read(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c<'0' | c> '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
const long long N = 200005;
const long long MOD = 1e9 + 7;
long long cnt[105];
long long cum[N];
long long ara[N];
int main() {
  long long n = ({
    long long a;
    read(a);
    a;
  }),
            m = ({
              long long a;
              read(a);
              a;
            });
  for (int i = 1; i <= n; i++)
    ara[i] = ({
      long long a;
      read(a);
      a;
    });
  long long s = 0;
  for (int i = 1; i <= n; i++) {
    s += ara[i];
    if (s <= m) {
      ++cnt[ara[i]];
      cout << 0 << ' ';
      continue;
    }
    long long s2 = s;
    long long c = 0;
    for (long long j = 100; j >= 1; --j) {
      if (s2 <= m) break;
      if (!cnt[j]) continue;
      if (s2 - cnt[j] * j <= m) {
        s2 -= cnt[j] * j;
        c += cnt[j];
        s2 = m - s2;
        c -= s2 / j;
        break;
      } else {
        s2 -= cnt[j] * j;
        c += cnt[j];
      }
    }
    ++cnt[ara[i]];
    cout << c << ' ';
  }
}
