#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h;
  cin >> n >> h;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int ans = 0;
  long long int t = 0;
  vector<long long int> v;
  for (int i = 0; i < n; i++) {
    v.push_back(a[i]);
    sort(v.begin(), v.end());
    t = 0;
    for (int j = i; j >= 0; j -= 2) {
      t += v[j];
    }
    if (t <= h) {
      ans++;
    } else
      break;
  }
  cout << ans << endl;
}
