#include <bits/stdc++.h>
using namespace std;
long long ar[105];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, i, j, a, sum = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a;
    sum += a;
    if (a > m) {
      cout << i + 1 << ' ';
      ar[a]++;
      continue;
    }
    if (a == m) {
      cout << i << ' ';
      ar[a]++;
      continue;
    }
    if (sum <= m) {
      cout << "0" << ' ';
      ar[a]++;
      continue;
    }
    long long need = m - a, sm = 0, ct = 0;
    for (j = 1; j <= 100; j++) {
      if (ar[j] == 0) continue;
      if (j > need) break;
      if (((ar[j] * j)) <= need) {
        need -= (ar[j] * j);
        ct += ar[j];
      } else {
        long long k = need / j;
        ct += k;
        break;
      }
    }
    cout << i - ct << ' ';
    ar[a]++;
  }
  return 0;
}
