#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
const int N = 101;
long long times[N];
long long getsteps(long long curr, long long m, long long n, long long cnt) {
  long long res = 0;
  long long s = 0, e = cnt;
  while (s <= e) {
    long long mid = s + (e - s) / 2;
    if (curr - mid * n <= m) {
      res = mid;
      e = mid - 1;
    } else {
      s = mid + 1;
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long sum = 0, curr;
  for (long long i = 0; i < n; i++) {
    long long step = 0;
    sum += a[i];
    if (sum > m) {
      curr = sum;
      for (long long i = N - 1; i >= 0; i--) {
        long long power = i * times[i];
        if (curr - power > m) {
          curr -= power;
          step += times[i];
        } else {
          step += getsteps(curr, m, i, times[i]);
          break;
        }
      }
    }
    times[a[i]]++;
    cout << step << ' ';
  }
  return 0;
}
