#include <bits/stdc++.h>
using namespace std;
const int T = 100;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> t(n + 1), pref(n + 1), count(100 + 1, 0);
  for (int i = 1; i <= n; ++i) cin >> t[i];
  partial_sum(t.begin(), t.end(), pref.begin());
  for (int i = 1; i <= n; ++i) {
    int d = pref[i] - m;
    int cnt = 0;
    if (d > 0) {
      for (int j = 100; j > 0; --j) {
        int x = j * count[j];
        if (d <= x) {
          cnt += (d + j - 1) / j;
          break;
        }
        cnt += count[j];
        d -= x;
      }
    }
    count[t[i]]++;
    cout << cnt << " ";
  }
  return 0;
}
