#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];
  vector<int> ans(n, 0);
  int sum = 0;
  set<pair<int, int>> t;
  set<pair<int, int>> unused;
  vector<int> was(111, 0);
  set<int> s;
  for (int i = 0; i < n; i++) {
    sum += a[i];
    int kol = 0;
    int summ = sum;
    for (auto y : s) {
      if (sum <= m) break;
      int x = y;
      x *= -1;
      int k = was[x];
      if (sum - k * x > m) {
        kol += was[x];
        sum -= k * x;
      } else {
        kol += (sum - m + x - 1) / x;
        break;
      }
    }
    sum = summ;
    ans[i] = kol;
    s.insert(-a[i]);
    was[a[i]]++;
  }
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  return 0;
}
