#include <bits/stdc++.h>
using namespace std;
long long int a[200005];
long long int ans[200005];
long long int done[105][200005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k, n, m;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    for (j = i + 1; j < n; j++) done[a[i]][j]++;
  }
  long long int sum = 0;
  for (i = 0; i < n; i++) {
    sum += a[i];
    if (sum <= m)
      ans[i] = 0;
    else {
      long long int temp = sum;
      long long int count = 0;
      for (j = 100; j >= 1; j--) {
        if (done[j][i] != 0) {
          long long int temp1;
          if ((temp - m) % j == 0)
            temp1 = (temp - m) / j;
          else
            temp1 = ((temp - m) / j) + 1;
          if (done[j][i] >= temp1) {
            temp = temp - temp1 * j;
            count += temp1;
          } else {
            temp = temp - done[j][i] * j;
            count += done[j][i];
          }
        }
        if (temp <= m) break;
      }
      ans[i] = count;
    }
  }
  for (i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
