#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
int cnt[105];
int main() {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    sum += a;
    int d = sum - m, ans = 0;
    for (int j = 100; d > 0 and j > 0; j--) {
      if (j * cnt[j] >= d) {
        ans += (d + j - 1) / j;
        break;
      }
      ans += cnt[j];
      d -= j * cnt[j];
    }
    ++cnt[a];
    cout << ans << " ";
  }
  return 0;
}
