#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, H;
  cin >> N >> H;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<long long> b;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    b.push_back(A[i]);
    sort(b.begin(), b.end());
    long long sum = 0;
    for (int i = b.size() - 1; i >= 0; i -= 2) {
      sum += b[i];
    }
    if (sum <= H)
      ans++;
    else
      break;
  }
  cout << ans << endl;
  return 0;
}
