#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 200;
long long n, m, x, p[N], l, r, c, ans, res, kol, sum;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (sum + x > m) {
      res = 0;
      ans = 0;
      for (int j = 100; j > 0; j--)
        if (p[j]) {
          if (sum - (res + j * p[j]) + x > m) {
            ans += p[j];
            res += p[j] * j;
            continue;
          }
          if (sum - res + x <= m) {
            cout << ans << " ";
            break;
          }
          l = 1;
          r = p[j];
          while (l < r) {
            c = (l + r) / 2;
            if (sum - (res + c * j) + x > m)
              l = c + 1;
            else
              r = c;
          }
          if (l > 1 && sum - (res + (l - 1) * j) + x <= m) l--;
          cout << ans + l << " ";
          break;
        }
    } else
      cout << "0 ";
    sum += x;
    p[x]++;
  }
  return 0;
}
