#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, i, x = 0, ans = 0, x1 = 0;
  cin >> n >> m;
  vector<long long int> v;
  long long int a[n], b[101], j;
  for (i = 0; i < 101; i++) {
    b[i] = 0;
  }
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    x1 = x1 + a[i];
    x = x1;
    ans = 0;
    if (x > m) {
      j = 100;
      while (x > m) {
        if (x - (j * b[j]) >= m) {
          x = x - j * b[j];
          ans = ans + b[j];
        } else {
          ans = ans + b[j] - ((m - (x - j * b[j])) / j);
          x = 0;
        }
        j--;
      }
      v.push_back(ans);
    } else {
      v.push_back(0);
    }
    b[a[i]]++;
  }
  for (i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  return 0;
}
