#include <bits/stdc++.h>
using namespace std;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string Alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string glas = "aeiou";
long long int Mod = pow(10, 9) + 7;
long long int ctoi(char x) {
  long long int xx = int(x) - 48;
  return xx;
}
long long int one = 1;
long long int null = 0;
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  long long int n, h;
  cin >> n >> h;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
  }
  long long int sum = 0;
  vector<long long int> ans;
  long long int a = 0, c = 0;
  for (long long int i = 0; i < n; i++) {
    sum = 0;
    ans.push_back(v[i]);
    sort(ans.rbegin(), ans.rend());
    for (long long int j = 0; j < ans.size(); j++) {
      if (j % 2 != 0) {
        sum += max(ans[j], ans[j - 1]);
      }
    }
    if (i % 2 == 0) {
      sum += ans[i];
    }
    if (sum <= h) {
      a = i + 1;
    }
  }
  cout << a;
}
