#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long inf = 1e18;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  long long cnt[n];
  long long sum = 0, f = 0, c = 0;
  map<long long, long long> make_pair;
  for (long long i = 0; i < n; i++) {
    sum += arr[i];
    if (sum <= m) {
      cnt[i] = 0;
      make_pair[arr[i]]++;
      continue;
    }
    long long temp = m - arr[i];
    long long curr = 0;
    long long f = 0;
    for (long long j = 1; j <= 100; j++) {
      if (make_pair[j] == 0) continue;
      if (temp >= make_pair[j] * j) {
        temp -= make_pair[j] * j;
        f += make_pair[j];
      } else {
        f += temp / j;
        temp -= (temp / j) * j;
      }
      if (temp < j) {
        cnt[i] = i - f;
        break;
      }
    }
    make_pair[arr[i]]++;
  }
  for (long long i = 0; i < n; i++) cout << cnt[i] << " ";
}
