#include <bits/stdc++.h>
using namespace std;
const int maxn = 200;
int b[maxn], a[maxn];
int main() {
  int n, m, res = 0, sum = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    res = 0;
    for (int j = 0; j < i; j++) b[j] = a[j];
    sort(b, b + i);
    sum = a[i];
    for (int j = 0; j < i && sum + b[j] <= m; j++) sum += b[j], res++;
    cout << i - res << ' ';
  }
}
