#include <bits/stdc++.h>
bool myfunction(int i, int j) { return (i > j); }
using namespace std;
int main() {
  int n, h;
  int a[1010];
  cin >> n >> h;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int i;
  vector<int> array;
  for (i = 0; i < n; i++) {
    int height = h;
    array.push_back(a[i]);
    std::sort(array.begin(), array.end(), myfunction);
    if ((i + 1) % 2 == 1) {
      height -= array[i];
      for (int j = 0; j <= i - 1; j += 2) {
        height -= array[j];
      }
      if (height < 0) break;
    } else {
      for (int j = 0; j <= i; j += 2) {
        height -= array[j];
      }
      if (height < 0) break;
    }
  }
  cout << i;
  return 0;
}
