#include <bits/stdc++.h>
using namespace std;
const long long INFLL = 1e18;
const int MAXN = 3e5;
const long long INF = 1e9;
const long long kek = 998244353;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  vector<long long> t(101, 0);
  long long sum = 0;
  for (int i = 0; i < (n); i++) {
    long long x;
    cin >> x;
    long long u = sum;
    long long cnt = 0;
    long long j = 100;
    while (m - u + t[j] * j < x) {
      u -= t[j] * j;
      cnt += t[j];
      j--;
    }
    if (j > 0) {
      cnt += (x + u - m + j - 1) / j;
    }
    cout << cnt << " ";
    t[x]++;
    sum += x;
  }
}
