#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
inline int pls(int x, int y) {
  x += y;
  return x >= mod ? x - mod : x;
}
inline int dec(int x, int y) {
  x -= y;
  return x < 0 ? x + mod : x;
}
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int mul(int x, int y, int z) { return mul(mul(x, y), z); }
inline int mul(int x, int y, int z, int p) { return mul(mul(x, y), mul(z, p)); }
inline void add(int &x, int y) {
  x += y;
  x = (x >= mod) ? x - mod : x;
}
inline int fpw(int x, int y, int r = 1) {
  for (; y; y >>= 1, x = mul(x, x))
    if (y & 1) r = mul(r, x);
  return r;
}
inline int inv(int x) { return fpw(x, mod - 2); }
inline int gi() {
  int x;
  int _w = scanf("%d", &x);
  return x;
}
inline void gi(int &x) { int _w = scanf("%d", &x); }
inline void write(int x) { printf("%d\n", x); }
void chkmax(int &x, int y) { x = (x > y) ? x : y; }
void chkmin(int &x, int y) { x = (x < y) ? x : y; }
const int INF = 0x3f3f3f3f;
template <typename T>
inline void debug(T x) {
  cerr << x;
  return;
}
const int maxn = 1e6 + 10;
int n, m, a[maxn];
int Sm[maxn];
inline int work(int x) {
  int pre = 0, peo = 0;
  for (int i = 100; i >= 1; --i) {
    if (pre + i * Sm[i] >= x) {
      int t = ((x - pre - 1) / i) + 1;
      return peo + t;
    } else
      pre += i * Sm[i], peo += Sm[i];
  }
  return -1;
}
int main() {
  n = gi(), m = gi();
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    a[i] = gi();
    sum += a[i];
    if (sum <= m) {
      printf("0 ");
    } else {
      printf("%d ", work(sum - m));
    }
    Sm[a[i]]++;
  }
  return 0;
}
