#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, h;
  cin >> n >> h;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long temp = n;
  while (temp) {
    long long b[temp], sum = 0;
    ;
    for (int i = 0; i < temp; i++) b[i] = a[i];
    sort(b, b + temp);
    for (long long j = temp - 1; j >= 0; j -= 2) {
      sum += b[j];
    }
    if (sum <= h) {
      cout << temp;
      break;
    }
    temp--;
  }
  return 0;
}
