#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, h, i, j, k, o, l, p;
  vector<long long int> v;
  cin >> n >> h;
  for (long long int i = 0; i <= n - 1; i++) {
    cin >> p;
    v.push_back(p);
    sort(v.begin(), v.end());
    k = 0;
    for (long long int j = 0; j <= i; j++) {
      if (j % 2 == 1 || j == i) k += v[j];
    }
    if (i % 2 == 0) {
      k = v[0];
      for (long long int j = 1; j <= i - 2; j++) {
        if (j % 2 == 0) k += v[j];
      }
      if (i != 0) k += v[i];
    }
    if (k <= h)
      l = i + 1;
    else
      break;
  }
  cout << l;
  return 0;
}
