#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int X = 105;
ll C[X];
ll N, M, P;
ll calc(ll x) {
  ll i, s, ans;
  s = P;
  ans = 0;
  for (i = 100; i > 0; --i) {
    if (s - i * C[i] > M) {
      s -= i * C[i];
      ans += C[i];
    } else {
      ans += (s - M + i - 1) / i;
      break;
    }
  }
  if (ans < 0) ans = 0;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, i, x;
  cin >> n >> M;
  P = 0;
  for (i = 0; i < n; ++i) {
    cin >> x;
    P += x;
    cout << calc(x) << " ";
    ++C[x];
  }
  return 0;
}
