#include <bits/stdc++.h>
using namespace std;
bool compare(long long int a, long long int b) { return a > b; }
unsigned seed = chrono::steady_clock::now().time_since_epoch().count();
long long int modexp(long long int x, long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y % 2) res = res * x % 998244353;
    x = x * x % 998244353;
    y /= 2;
  }
  return res;
}
long long int modinv(long long int x) { return modexp(x, 998244353 - 2); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, k;
  cin >> n >> k;
  vector<long long int> t(n);
  for (long long int i = 0; i < n; i++) cin >> t[i];
  vector<long long int> v(n);
  map<long long int, long long int> m;
  for (long long int i = 0; i < n; i++) {
    long long int c = 0;
    long long int sum = t[i];
    for (auto x : m) {
      if (sum + (x.first * x.second) < k) {
        sum += x.first * x.second;
        c += x.second;
      } else {
        long long int d = k - sum;
        c += d / x.first;
        break;
      }
    }
    v[i] = i - c;
    m[t[i]]++;
  }
  for (long long int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << "\n";
  ;
}
