#include <bits/stdc++.h>
using namespace std;
int main() {
  setlocale(LC_ALL, "RUS");
  int n, h, x, sum = 0;
  vector<int> A;
  cin >> n >> h;
  while (n--) {
    cin >> x;
    A.push_back(x);
    sort(A.rbegin(), A.rend());
    for (int i = 0; i < A.size(); i += 2) sum += A[i];
    if (sum > h) {
      A.erase(A.begin(), A.begin() + 1);
      break;
    } else
      sum = 0;
  }
  cout << A.size();
  return 0;
}
