#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, h;
  cin >> n >> h;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int k = n; k >= 0; k--) {
    vector<long long int> v(a.begin(), a.begin() + k);
    sort(v.rbegin(), v.rend());
    long long int sum = 0;
    for (long long int i = 0; i < k; i += 2) {
      sum += v[i];
    }
    if (sum <= h) {
      cout << k << endl;
      return;
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
