#include <bits/stdc++.h>
using namespace std;
int arr[1000 + 7];
priority_queue<int> pq;
int main() {
  ios_base::sync_with_stdio(false);
  int n, h, ans = 0;
  cin >> n >> h;
  for (int i = 0; i < n; i++) cin >> arr[i];
  int temp, sum = 0;
  for (int i = 1; i <= n; i++) {
    sum = 0;
    pq = priority_queue<int>();
    for (int j = 0; j < i; j++) {
      pq.push(arr[j]);
    }
    while (!pq.empty()) {
      temp = pq.top();
      pq.pop();
      if (!pq.empty()) pq.pop();
      sum += temp;
    }
    if (sum <= h) {
      ans = i;
      continue;
    }
    break;
  }
  cout << ans << endl;
  return 0;
}
