#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long add(long long a, long long b) { return (a + b) % MOD; }
long long sub(long long a, long long b) { return ((a - b) % MOD + MOD) % MOD; }
long long mul(long long a, long long b) { return (a * b) % MOD; }
long long a[800000], tim[200];
set<long long> se;
long long n, m;
bool check(long long x, long long s) {
  long long mid = x;
  long long p = -1, sum = 0;
  for (int i = 100; i >= 1; i--) {
    if (tim[i] <= x)
      x -= tim[i];
    else if (tim[i] > x && p == -1) {
      p = tim[i] - x;
      x = -1;
      sum += p * i;
    } else if (p != -1) {
      sum += i * tim[i];
    }
  }
  if (m - sum >= a[s]) return true;
  return false;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    long long l = 0, r = i + 1, mid, ans = LLONG_MAX;
    while (l <= r) {
      mid = (l + r) >> 1;
      if (check(mid, i)) {
        r = mid - 1;
        ans = min(ans, mid);
      } else
        l = mid + 1;
    }
    cout << ans << " ";
    tim[a[i]]++;
  }
}
