#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 5;
int a[maxn];
int s[maxn];
int n, m;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    int j;
    for (j = 0; j < i; j++) {
      sum += a[j];
      s[j] = a[j];
    }
    if (sum <= m) {
      cout << 0;
      if (i < n) {
        cout << " ";
      }
    } else {
      sort(s, s + j - 1);
      int cha = sum - m;
      int count = 0, sum2 = 0;
      for (int k = j - 2; k >= 0; k--) {
        count++;
        sum2 += s[k];
        if (sum2 >= cha) {
          cout << count;
          if (i < n) {
            cout << " ";
          }
          break;
        }
      }
    }
  }
  cout << endl;
  return 0;
}
