#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  t = 1;
  while (t--) {
    int n, m;
    cin >> n >> m;
    vector<int> t(n), pref(n + 1);
    pref[0] = 0;
    for (int i = 0; i < n; i++) {
      cin >> t[i];
      pref[i + 1] = pref[i] + t[i];
    }
    multiset<int> s;
    for (auto it = t.begin(); it != t.end(); it++) {
      if (pref[it - t.begin() + 1] <= m) {
        cout << 0 << " ";
      } else {
        int c = 0, k = 0, v = pref[it - t.begin() + 1];
        auto it1 = s.end();
        it1--;
        while (v - c > m) {
          c += *it1;
          k++;
          if (it1 == s.begin()) {
            break;
          }
          it1--;
        }
        cout << k << " ";
      }
      s.insert(*it);
    }
    cout << endl;
  }
}
