#include <bits/stdc++.h>
using namespace std;
long long f[110];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long a[n];
  for (long long i = 0; i < n; ++i) cin >> a[i];
  long long sum = 0;
  vector<long long> ans;
  for (long long i = 0; i < n; ++i) {
    sum += a[i];
    long long cnt = 0;
    if (sum > m) {
      long long req = sum - m;
      for (long long j = 100; j >= 1; --j) {
        if (f[j]) {
          if (req > f[j] * j)
            req -= (f[j] * j), cnt += f[j];
          else {
            long long tmp = req / j;
            cnt += tmp;
            if (req % j) cnt++;
            break;
          }
        }
      }
    }
    ans.push_back(cnt);
    f[a[i]]++;
  }
  for (long long i : ans) cout << i << " ";
  cout << '\n';
}
