#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.14159265359;
const int mod = 1000000007;
const int MAX = 300009;
long long n, m, a[MAX], b[MAX], c[111];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i], b[i] = a[i];
  for (int i = 1; i <= n - 1; i++) a[i] += a[i - 1];
  for (int j = 0; j < n; j++) {
    long long ans = 0;
    long long aj = a[j];
    if (aj <= m)
      cout << 0 << " ";
    else {
      for (int i = 100; i >= 1; i--) {
        if (c[i] == 0) continue;
        if (aj - i * c[i] > m)
          ans += c[i], aj -= i * c[i];
        else {
          if (aj > m) ans += ((aj - m) / i) + (((aj - m) % i) > 0);
          break;
        }
      }
      cout << ans << " ";
    }
    c[b[j]]++;
  }
}
