#include <bits/stdc++.h>
using namespace std;
int n, h, a[1003];
int main() {
  cin >> n >> h;
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = n; i > 0; i--) {
    int tmp = h;
    vector<int> v;
    for (int j = 0; j < i; j++) v.push_back(a[j]);
    sort(v.begin(), v.end());
    for (int j = i - 1; j >= 0; j -= 2)
      if (tmp >= 0) tmp -= v[j];
    if (tmp < 0)
      continue;
    else {
      cout << i;
      break;
    }
  }
}
