#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  cout << "0 ";
  vector<int> cnt(110, 0);
  cnt[a[0]]++;
  for (int w = 1; w < n; ++w) {
    int s = a[w];
    int k = 0;
    for (int i = 1; i <= 100; ++i) {
      if (s + i * cnt[i] <= m) {
        s += i * cnt[i];
        k += cnt[i];
      } else {
        int l = -1, r = cnt[i] + 1;
        while (r - l > 1) {
          int mid = (l + r) / 2;
          if (s + i * mid <= m) {
            l = mid;
          } else {
            r = mid;
          }
        }
        k += l;
        break;
      }
    }
    cout << w - k << ' ';
    cnt[a[w]]++;
  }
}
