#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);
  vector<int> freq(101);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int cur = 0;
  for (int i = 0; i < n; i++) {
    cur += a[i];
    int ans = 0;
    if (cur <= m) {
      ++freq[a[i]];
      cout << "0 ";
      continue;
    } else {
      int cur2 = cur;
      for (int j = 100; j >= 1; j--) {
        if (cur2 <= 0) break;
        if (freq[j] * j >= (cur2 - m)) {
          int rem = (cur2 - m + j - 1) / j;
          cur2 -= rem * j;
          ans += rem;
          break;
        } else {
          int canget = freq[j];
          cur2 -= canget * j;
          ans += canget;
        }
      }
    }
    ++freq[a[i]];
    cout << ans << " \n"[i == n - 1];
  }
}
