#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, j = 0;
  cin >> n >> m;
  long long sum = 0, arr[n], stu[n];
  for (int i = 0; i < n; i++) {
    int count = 0;
    cin >> arr[i];
    sum = sum + arr[i];
    stu[i] = arr[i];
    if (sum <= m) {
      cout << count << " ";
    } else {
      j = i - 1;
      int sum1 = sum;
      while (sum1 > m) {
        sum1 = sum1 - stu[j];
        j--;
        count++;
      }
      cout << count << " ";
    }
    int key = stu[i];
    j = i - 1;
    while (j >= 0 && stu[j] > key) {
      stu[j + 1] = stu[j];
      j = j - 1;
    }
    stu[j + 1] = key;
  }
  return 0;
}
