#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  if (!b) return a;
  return GCD(b, a % b);
}
long long Count_Digit(long long x) {
  if (!x) return 0;
  return Count_Digit(x / 10) + 1;
}
int a[101] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int n, m, t, sum = 0, k, p;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> t;
    sum += t;
    if (sum > m) {
      k = 0;
      p = sum;
      int j = 100;
      while (p > m) {
        int q = ceil(float(p - m) / float(j));
        if (q <= a[j]) {
          k += q;
          break;
        } else {
          k += a[j];
          p -= j * a[j];
        }
        j--;
      }
      cout << k << " ";
    } else
      cout << 0 << " ";
    a[t]++;
  }
  return 0;
}
