#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n, i, j, k, len, x, y, z, c, f, flag, p, q, mx, mn, l, r, sum,
      ans, tmp, it, pos, avg, m, cnt;
  {
    f = 0;
    flag = 0;
    ans = 0;
    cnt = 0;
    sum = 0;
    mn = LLONG_MAX;
    mx = LLONG_MIN;
    string s;
    cin >> n >> m;
    vector<long long int> v;
    map<long long int, long long int> dora;
    long long int a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    for (i = 0; i < n; i++) {
      long long int cur = sum + a[i] - m;
      ans = 0;
      if (cur > 0) {
        tmp = cur;
        for (j = 100; j >= 1; j--) {
          if (tmp <= 0) break;
          if (j * dora[j] <= tmp) {
            tmp = tmp - j * dora[j];
            ans += dora[j];
            continue;
          }
          x = ceil((long double)tmp / (long double)j);
          ans += x;
          break;
        }
      }
      sum += a[i];
      dora[a[i]]++;
      v.push_back(ans);
    }
    for (auto dsp : v) cout << dsp << " ";
    cout << "\n";
    ;
  }
  return 0;
}
