#include <bits/stdc++.h>
using namespace std;
inline void read(int &res) {
  register char ch = getchar();
  res = 0;
  register int g = 1;
  while (!isdigit(ch)) {
    if (ch == '-') g = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    res = (res << 3) + (res << 1) + (ch ^ 48);
    ch = getchar();
  }
  res *= g;
}
priority_queue<int> q;
int n, m, a[202000], ans[202000], sum = 0, t = 0;
int main() {
  read(n);
  read(m);
  for (register int i = 1; i <= n; i++) {
    read(a[i]);
  }
  for (register int i = 1; i <= n; i++) {
    t = 0;
    sum = 0;
    while (!q.empty()) q.pop();
    for (register int j = 1; j <= i - 1; j++) {
      t += a[j];
      q.push(a[j]);
    }
    while (t + a[i] > m) {
      t -= q.top();
      q.pop();
      sum++;
    }
    printf("%d ", sum);
  }
  return 0;
}
