#include <bits/stdc++.h>
using namespace std;
int n, h;
const int MAXN = 1005;
int a[MAXN];
vector<int> curr;
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> h;
  for (int i = 0; i < n; i++) cin >> a[i];
  bool done = false;
  for (int i = 0; i < n; i++) {
    curr.push_back(a[i]);
    sort(curr.rbegin(), curr.rend());
    int remain = h;
    for (int j = 0; j < curr.size(); j += 2) {
      if (remain >= curr[j])
        remain -= curr[j];
      else
        done = true;
    }
    if (done) {
      cout << i << "\n";
      break;
    }
  }
  if (!done) cout << n << "\n";
  return 0;
}
