#include <bits/stdc++.h>
using namespace std;
const long long N = 105;
long long counts[N];
int main(void) {
  long long i, j;
  long long n, M;
  cin >> n >> M;
  long long totSum = 0;
  for (j = 0; j < n; j++) {
    long long x;
    cin >> x;
    long long ans = 0;
    totSum += x;
    long long reqSum = max(0ll, totSum - M);
    for (i = N - 1; i >= 0; i--) {
      if (reqSum == 0) break;
      if (counts[i] == 0) continue;
      long long det = reqSum - (counts[i] * i);
      if (det > 0) {
        ans += counts[i];
        reqSum = det;
      } else if (det == 0) {
        ans += counts[i];
        break;
      } else {
        if (reqSum % i)
          ans += (reqSum / i) + 1;
        else
          ans += reqSum / i;
        break;
      }
    }
    counts[x]++;
    cout << ans << " ";
  }
  return 0;
}
