#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 1;
long long b[101];
void solve() {
  long long n, m;
  cin >> n >> m;
  long long a[n];
  for (long long i = 0; i < 101; i++) b[i] = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    if (i == 0) {
      sum += a[i];
      cout << 0 << " ";
      b[a[i]]++;
    } else {
      sum += a[i];
      if (sum <= m)
        cout << 0 << " ";
      else {
        long long diff = sum - m;
        long long count = 0;
        for (long long j = 100; j > 0 && diff; j--) {
          if (b[j] > 0) {
            if (diff < j * b[j]) {
              count += diff / j;
              if (diff % j) count++;
            } else {
              count += b[j];
            }
            diff -= min(j * b[j], diff);
          }
        }
        cout << count << " ";
      }
      b[a[i]]++;
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
