#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1234;
int a[MAXN];
int main() {
  int n, h;
  scanf("%d %d", &n, &h);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  vector<int> tmp;
  int ans = 1;
  for (int i = 0; i < n; i++) {
    tmp.push_back(a[i]);
    sort(tmp.begin(), tmp.end());
    long long cnt = 0, cnt2 = 0;
    for (int j = 0; j <= i; j += 2) {
      cnt += tmp[j];
    }
    for (int j = 1; j <= i; j += 2) cnt2 += tmp[j];
    if (cnt <= h && cnt2 <= h) ans = max(ans, i + 1);
  }
  printf("%d\n", ans);
  return 0;
}
