#include <bits/stdc++.h>
using namespace std;
int n, m;
set<int> timeset;
int freq[101] = {0};
void fastscan(int &x) {
  bool neg = false;
  register int c;
  x = 0;
  c = getchar();
  if (c == '-') {
    neg = true;
    c = getchar();
  }
  for (; (c > 47 && c < 58); c = getchar()) x = (x << 1) + (x << 3) + c - 48;
  if (neg) x *= -1;
}
int test(int time, int sum) {
  int count = 0;
  int req = m - time;
  while (sum > req) {
    for (auto it = timeset.rbegin(); it != timeset.rend(); it++) {
      int maxtime = *it;
      int num = freq[*it];
      if (sum - maxtime * num > req) {
        sum = sum - maxtime * num;
        count += num;
      } else {
        int num2 = ceil((1.0 * (sum - req)) / maxtime);
        sum = sum - num2 * maxtime;
        count += num2;
        break;
      }
    }
  }
  return count;
}
int main(void) {
  fastscan(n);
  fastscan(m);
  vector<int> ans(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int time;
    fastscan(time);
    ans[i] = test(time, sum);
    sum += time;
    freq[time]++;
    timeset.insert(time);
  }
  for (auto it : ans) cout << it << " ";
  cout << endl;
}
