#include <bits/stdc++.h>
using namespace std;
vector<long long> vin(long long n) {
  vector<long long> a(n);
  for (long long i = 0; i < n; i += 1) cin >> a[i];
  return a;
}
long long intin() {
  long long n;
  cin >> n;
  return n;
}
char charin() {
  char a;
  cin >> a;
  return a;
}
string strin() {
  string s;
  cin >> s;
  return s;
}
long long factorial(long long n) {
  return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  vector<long long> t = vin(n);
  map<long long, long long> counter;
  for (long long i = 1; i < 101; i += 1) {
    counter[i] = 0;
  }
  long long sum = 0, diff, num, part;
  for (auto i : t) {
    diff = sum + i - m;
    num = 0;
    if (diff > 0) {
      for (long long j = 100; j > -1; j += -1) {
        part = counter[j] * j;
        if (part > diff) {
          num += (j + diff - 1) / j;
          break;
        } else {
          num += counter[j];
          diff -= part;
        }
      }
      sum += i;
      counter[i]++;
      cout << num << " ";
    } else {
      sum += i;
      counter[i]++;
      cout << 0 << " ";
    }
  }
  return 0;
}
