#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long double PI = 4 * atan((long double)1);
void Init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int frq[107];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int x, tp = m, ct = 0;
    cin >> x;
    tp -= x;
    for (int j = 1; j <= 100; j++) {
      if (frq[j] * j >= tp) {
        ct += (tp / j);
        break;
      } else {
        tp -= (frq[j] * j);
        ct += frq[j];
      }
    }
    frq[x]++;
    cout << (i - ct);
    (i == n - 1) ? cout << endl : cout << " ";
  }
}
