#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, h, v[1100];
  multiset<long long> s;
  cin >> n >> h;
  for (int i = 0; i < n; i++) cin >> v[i];
  long long k, ht;
  for (int i = 0; i < n; i++) {
    s.insert(v[i]);
    k = 0;
    ht = 0;
    for (multiset<long long>::reverse_iterator rit = s.rbegin();
         rit != s.rend(); ++rit) {
      if (k % 2 == 0) ht += *rit;
      k++;
    }
    if (ht > h) {
      cout << i << '\n';
      return 0;
    }
  }
  cout << n << '\n';
  return 0;
}
