#include <bits/stdc++.h>
using namespace std;
long long int N, M;
long long int cnt[105] = {0};
long long int bsearch(long long int counts, long long int kitnatime,
                      long long int dum) {
  long long int l = 1, r = counts;
  long long int ans = -1;
  while (l <= r) {
    long long int mid = (l + r) / 2;
    if (dum - mid * kitnatime <= M) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> N >> M;
  long long int x, sum = 0;
  for (long long int i = 1; i <= N; i++) {
    cin >> x;
    sum += x;
    if (sum <= M) {
      cout << 0 << endl;
    } else {
      long long int dum = sum;
      long long int ans = 0;
      for (long long int j = 100; j >= 1; j--) {
        if (cnt[j] == 0) continue;
        long long int check = bsearch(cnt[j], j, dum);
        if (check == -1) {
          ans += cnt[j];
          dum -= j * cnt[j];
        } else {
          ans += check;
          break;
        }
      }
      cout << ans << " ";
    }
    cnt[x]++;
  }
}
