#include <bits/stdc++.h>
const double pi = 2.0 * acos(0.0);
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int t = 1, kase = 1;
  while (t--) {
    long long n, i, j, h, k = 0;
    cin >> n >> h;
    long long a[n];
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (i = 1; i <= n; i++) {
      sort(a, a + i, greater<long long>());
      long long sum = 0;
      for (j = 0; j < i; j += 2) {
        sum += a[j];
      }
      if (sum <= h)
        k = i;
      else
        break;
    }
    cout << k << endl;
  }
  return 0;
}
