#include <bits/stdc++.h>
using namespace std;
template <typename T>
T lcm(T a, T b) {
  return a / __gcd(a, b) * b;
}
template <class T>
inline T bigmod(T p, T e, T M) {
  T ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class string>
long long int strton(string s) {
  long long int won;
  stringstream ss;
  ss << s;
  ss >> won;
  return won;
}
template <class T>
string ntostr(T n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
template <class T>
inline T mod(T n, T m) {
  return (n % m + m) % m;
}
template <class T>
bool isprime(T n) {
  if (n % 2 == 0) {
    if (n == 2)
      return true;
    else
      return false;
  }
  T m = sqrt(n);
  for (T i = 3; i <= m; i += 2) {
    if (n % i == 0) return false;
  }
  return true;
}
bool isvowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
double triangle_area1(double a, double b, double c) {
  double s = (a + b + c) * 0.5;
  return sqrt(s * (s - a) * (s - b) * (s - c));
}
double triangle_area2(double x1, double y1, double x2, double y2, double x3,
                      double y3) {
  return 0.5 * abs(x1 * y2 + x2 * y3 + x3 * y1 - x2 * y1 - x3 * y2 - x1 * y3);
}
double circle_area(double r, double theta) {
  return (theta * (2.0 * acos(0.0)) * r * r) / (2 * (2.0 * acos(0.0)));
}
double quad_area(double x1, double y1, double x2, double y2, double x3,
                 double y3, double x4, double y4) {
  return 0.5 * abs(x1 * y2 + x2 * y3 + x3 * y4 + x4 * y1 - x2 * y1 - x3 * y2 -
                   x4 * y3 - x1 * y4);
}
double cosangle(double a, double b, double c) {
  return acos((double)(b * b + c * c - a * a) / (double)(2 * b * c));
}
long long int Set(long long int N, long long int pos) {
  return N = N | (1ll << pos);
}
long long int reset(long long int N, long long int pos) {
  return N = N & ~(1ll << pos);
}
bool check(long long int N, long long int pos) {
  return (bool)(N & (1ll << pos));
}
long long int n, m, a, sm = 0, cnt[105];
int main() {
  scanf("%lld%lld", &n, &m);
  for (long long int i = 0; i < n; i++) {
    scanf("%lld", &a);
    sm += a;
    long long int rem = sm - m, ans = 0;
    for (long long int j = 100; j > 0; j--) {
      if (cnt[j] == 0) continue;
      if (rem <= 0) break;
      long long int x = rem / j;
      if (rem % j) x++;
      long long int y = min(cnt[j], x);
      ans += y;
      rem -= y * j;
    }
    if (i) printf(" ");
    printf("%lld", ans);
    cnt[a]++;
  }
  printf("\n");
}
