#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n), p(n), v;
  int c = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    c += a[i];
    p[i] = c;
  }
  int k = 0, l, x;
  vector<int> u(101, 0);
  for (int i = 0; i < n; i++) {
    l = 0;
    if (p[i] <= m) {
      v.push_back(0);
    } else {
      k = p[i];
      x = k - m;
      for (int j = 100; j > 0; j--) {
        if (x <= (j * u[j])) {
          l += (x + (j - 1)) / j;
          v.push_back(l);
          break;
        } else {
          x -= (j * u[j]);
          l += u[j];
        }
      }
    }
    u[a[i]]++;
  }
  for (auto &ele : v) {
    cout << ele << " ";
  }
  cout << "\n";
}
