#include <bits/stdc++.h>
using namespace std;
long long que[1010];
long long nowque[1010];
int main() {
  long long n, h;
  long long res;
  cin >> n;
  cin >> h;
  for (int i = 1; i <= n; i++) cin >> que[i];
  for (int i = 1; i <= n; i++) {
    long long cnt = 0;
    for (int j = 1; j <= i; j++) nowque[++cnt] = que[j];
    sort(nowque + 1, nowque + i + 1);
    long long ans = 0;
    for (int j = i; j >= 1; j -= 2) ans += nowque[j];
    if (ans <= h) res = i;
  }
  cout << res;
  return 0;
}
