#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long arr[200002], time_freq[101];
void solve() {
  long long total_time = 0;
  for (long long i = 0; i < n; i++) {
    long long exam_start_time = total_time + arr[i] - m;
    int student_removed = 0;
    if (exam_start_time > 0) {
      for (int j = 100; j > 0; j--) {
        long long y = time_freq[j] * j;
        if (exam_start_time <= y) {
          student_removed += ((exam_start_time + j - 1) / j);
          break;
        }
        exam_start_time -= (time_freq[j] * j);
        student_removed += time_freq[j];
      }
    }
    total_time += arr[i];
    time_freq[arr[i]]++;
    cout << student_removed << " ";
  }
  cout << endl;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> arr[i];
  ;
  solve();
  return 0;
}
