#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
const int N = 200005;
const int inf = 1000 * 1000 * 1000;
const int mod = 998244353;
int n, m;
pair<int, int> p[N];
int a[N];
int t[105];
int main() {
  mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    int S = 0;
    int cnt = 0;
    int rem = m - a[i];
    for (int j = 1; j <= 100; j++) {
      S += j * t[j];
      cnt += t[j];
      if (S > rem) {
        S -= j * t[j];
        cnt -= t[j];
        cnt += (rem - S) / j;
        break;
      }
    }
    t[a[i]]++;
    printf("%d ", i - 1 - cnt);
  }
  cout << endl;
  return 0;
}
