#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int t[N];
int main() {
  int n, limit;
  scanf("%d%d", &n, &limit);
  for (int i = 1; i <= n; ++i) scanf("%d", &t[i]);
  priority_queue<int> pq;
  queue<int> q;
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    sum += t[i];
    int res = 0;
    int prev = sum;
    while (sum > limit) {
      sum -= pq.top();
      q.push(pq.top());
      pq.pop();
      ++res;
    }
    sum = prev;
    while (q.size()) pq.push(q.front()), q.pop();
    pq.push(t[i]);
    printf("%d ", res);
  }
  return 0;
}
