#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, h;
  cin >> n >> h;
  int a[n + 5];
  for (int i = 1; i <= n; i++) cin >> a[i];
  vector<int> t;
  for (int i = 1; i <= n; i++) {
    t.push_back(a[i]);
    int p = 0;
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    for (int j = 0; j < t.size(); j += 2) {
      p += t[j];
    }
    if (p > h) {
      cout << i - 1 << endl;
      return 0;
    }
  }
  cout << n << endl;
  return 0;
}
