#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b < a) {
    long long int temp = a;
    a = b;
    b = temp;
  }
  if (a == 0) {
    return b;
  }
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return (a * b / gcd(a, b));
}
long long int fact(long long int x) {
  long long int ans = 1;
  if (x == 0) {
    return 1;
  }
  while (x > 0) {
    ans = (ans * x);
    x--;
  }
  return ans;
}
long long int power(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      ans *= a;
      ans = ans;
    }
    b /= 2;
    a *= a;
    a = a;
  }
  return ans;
}
vector<long long int> getbinary(int x) {
  vector<long long int> bin(10, 0);
  long long int iter = 0;
  while (x > 0) {
    if (x % 2 == 1) {
      bin[iter] = 1;
    } else {
      bin[iter] = 0;
    }
    iter++;
    x /= 2;
  }
  return bin;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m, s = 0, a = 0, x, i;
  cin >> n >> m;
  set<long long int>::iterator it;
  set<long long int> t, temp;
  long long int z[105], z1[105];
  for (i = 0; i < 105; i++) {
    z[i] = z1[i] = 0;
  }
  for (i = 0; i < n; i++) {
    cin >> x;
    a = 0;
    s += x;
    t = temp;
    long long int d;
    for (d = 0; d < 105; d++) z[d] = z1[d];
    d = s - m;
    while (d > 0) {
      long long int max = *t.rbegin();
      if (z[max] * max <= d) {
        a += z[max];
        d -= (z[max] * max);
        t.erase(t.find(max));
        z[max] = 0;
        continue;
      }
      z[max] -= (d / max);
      a += (d / max);
      if (d % max != 0) {
        z[max] -= 1;
        a += 1;
      }
      if (z[max] <= 0) {
        z[max] = 0;
        t.erase(t.find(max));
      }
      d = 0;
    }
    cout << a << " ";
    z1[x]++;
    temp.insert(x);
  }
}
