#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
long long pre[maxn];
vector<int> c(101, 0);
int t[maxn];
int n, m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> t[i];
  }
  pre[0] = 0;
  for (int i = 1; i <= n; ++i) {
    pre[i] = pre[i - 1] + t[i];
  }
  for (int i = 1; i <= n; ++i) {
    int ans = 0;
    long long sum = pre[i];
    bool flag = 0;
    if (sum > m) {
      for (int k = 100; k >= 1; k--) {
        int x = k * c[k];
        if (sum - x <= m) {
          ans += (sum - m + k - 1) / k;
          break;
        }
        ans += c[k];
        sum -= x;
      }
    }
    c[t[i]]++;
    cout << ans << " ";
  }
  return 0;
}
