#include <bits/stdc++.h>
using namespace std;
long long dx[4] = {1, 0, -1, 0};
long long dy[4] = {0, -1, 0, 1};
template <class T>
void inputVector(vector<T>& v, long long n) {
  v.resize(n);
  for (long long i = 0; i < v.size(); i++) cin >> v[i];
}
signed main() {
  long long n, H;
  cin >> n >> H;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) scanf("%lld", &a[i]);
  long long ret = 0;
  for (long long i = (1); i <= (n); i++) {
    long long h = H;
    vector<long long> b;
    for (long long j = 0; j < (i); j++) b.push_back(a[j]);
    sort((b).begin(), (b).end());
    reverse((b).begin(), (b).end());
    long long idx = 0;
    while (idx < b.size()) {
      if (h < b[idx]) break;
      h -= b[idx];
      idx++;
      if (idx == b.size()) break;
      idx++;
    }
    if (idx != b.size()) break;
    ret = i;
  }
  cout << ret << endl;
  return 0;
}
