#include <bits/stdc++.h>
int a, b, c, d;
int main() {
  std::cin >> a >> b;
  int ni = 0;
  std::vector<int> v;
  std::cin >> d;
  v.push_back(d);
  ni = ni + d;
  std::cout << "0 ";
  for (int k = 1; k < a; k++) {
    std::cin >> c;
    ni = ni + c;
    int jum = ni;
    if (jum <= b) {
      std::cout << "0 ";
    } else {
      std::sort(v.rbegin(), v.rend());
      int y = 0;
      int hasil = 0;
      while (jum > b) {
        if (jum <= b) {
          break;
        } else {
          jum = jum - v[y];
          y++;
          hasil++;
        }
      }
      std::cout << hasil << ' ';
    }
    v.push_back(c);
  }
}
