#include <bits/stdc++.h>
using namespace std;
long long n, A[300007], h, i;
vector<long long> V, S;
int main() {
  scanf("%lld %lld\n", &n, &h);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &A[i]);
    if (A[i] > h) break;
    V.push_back(A[i]);
  }
  if (A[i] > h) i--;
  while (i >= 1) {
    S = V;
    long long res = 0;
    sort(S.begin(), S.end());
    for (int j = S.size() - 1; j >= 0; j -= 2) {
      res += S[j];
      if (res > h) break;
    }
    if (res <= h) {
      printf("%lld\n", i - 1);
      return 0;
    }
    i--;
    V.resize(V.size() - 1);
  }
}
