#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  long long t, n, m;
  t = 1;
  while (t--) {
    cin >> n >> m;
    vector<long long> v(n);
    vector<long long> fr(101, 0);
    long long sum = 0;
    for (long long i = 0; i < n; i++) {
      cin >> v[i];
      long long check = sum, count = 0;
      if (check + v[i] <= m)
        cout << 0 << " ";
      else {
        for (long long j = 100; j >= 1; j--) {
          if (fr[j] > 0) {
            if (check + v[i] - fr[j] * j > m) {
              check -= fr[j] * j;
              count += fr[j];
            } else if (check + v[i] - fr[j] * j == m) {
              check -= fr[j] * j;
              count += fr[j];
              break;
            } else {
              long long d = check + v[i] - m;
              count += ceil(d / (long double)j);
              break;
            }
          }
        }
        cout << count << " ";
      }
      sum += v[i];
      fr[v[i]]++;
    }
  }
  return 0;
}
