#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, he;
  cin >> n >> he;
  long long h[n];
  for (long long i = 0; i < n; i++) cin >> h[i];
  long long k = 0;
  for (k = 0; k < n; k++) {
    sort(h, h + k + 1, greater<long long>());
    long long height = 0;
    for (long long i = 0; i <= k; i += 2) height += h[i];
    if (height > he) break;
  }
  cout << k << endl;
}
