#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  vector<int> vec(101, 0);
  vector<vector<int> > dp;
  for (int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    dp.push_back(vec);
    int cou = m - x;
    int rem = 0;
    for (int j = 1; j <= 100; j++) {
      if (cou / j >= vec[j])
        cou -= vec[j] * j;
      else {
        int no = cou / j;
        cou -= no * j;
        rem = rem + vec[j] - no;
      }
    }
    cout << rem << " ";
    vec[x]++;
  }
}
