#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long int n, h;
  cin >> n >> h;
  vector<unsigned long int> v(n);
  for (unsigned long int i = 0; i < n; i++) {
    cin >> v[i];
  }
  unsigned long int ans = 1;
  int f = 0;
  for (unsigned long int k = 2; k <= n; k++) {
    if (f == 1) {
      break;
    }
    sort(v.begin(), v.begin() + k, greater<int>());
    unsigned long int s = 0;
    for (unsigned long int i = 0; i < k; i = i + 2) {
      s += v[i];
      if (s > h) {
        f = 1;
        break;
      }
      if (s <= h && k % 2 == 0)
        ans = max(ans, i + 2);
      else if (s <= h) {
        ans = max(ans, i + 1);
      }
    }
  }
  cout << ans;
  return 0;
}
