#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a < b) return (gcd(b, a));
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  long long n, M, i, t, s = 0, c, z, l;
  cin >> n >> M;
  vector<long long> a(105, 0);
  vector<long long> v(n);
  for (i = 0; i < n; i++) {
    cin >> v[i];
  }
  vector<long long> p(n);
  p[0] = 0;
  p[1] = v[0];
  for (i = 2; i < n; i++) {
    p[i] = p[i - 1] + v[i - 1];
  }
  for (i = 0; i < n; i++) {
    if ((p[i] + v[i]) <= M)
      cout << 0 << " ";
    else {
      z = 100, l = (p[i] + v[i]), c = 0;
      while (l > M) {
        c = c + a[z];
        l = l - z * a[z];
        z--;
      }
      if (l == M)
        cout << c << " ";
      else {
        c = c - (M - l) / (z + 1);
        cout << c << " ";
      }
    }
    a[v[i]]++;
  }
}
