#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e4;
const long long int mod = 1e9 + 7;
long long int power(long long int x, long long int y) {
  if (y == 0) return 1;
  long long int a = power(x, y / 2);
  a = (a * a) % mod;
  if (y % 2) a = (a * x % mod) % mod;
  return a;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  long long int i, j, k, a, b, n, q, c, d, a1, b1, c1,
      ans = 0, flag = 1, cnt1 = 0, cnt2 = 0, M, sum = 0;
  cin >> n >> M;
  long long int arr[n], hash[102] = {0}, sol[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    sol[i] = 0;
  }
  for (i = 0; i < n; i++) {
    sum += arr[i];
    if (sum <= M) {
      sol[i] = 0;
    } else {
      a = sum - M;
      for (j = 100; j >= 1; j--) {
        if (hash[j] > 0) {
          if (hash[j] * j >= a) {
            b = (a / j);
            c = (a % j);
            sol[i] += b;
            if (c != 0) sol[i] += 1;
            a = 0;
            break;
          } else {
            sol[i] += hash[j];
            a = a - (hash[j] * j);
          }
        }
      }
    }
    hash[arr[i]]++;
  }
  for (i = 0; i < n; i++) cout << sol[i] << " ";
  cout << endl;
  return 0;
}
