#include <bits/stdc++.h>
using namespace std;
int a[3050];
bool cmp(int a, int b) { return a > b; }
int main() {
  int n, h, j;
  scanf("%d%d", &n, &h);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  set<int> se;
  int flag = 1;
  for (j = 1; j <= n; j++) {
    vector<int> ve;
    for (int k = 0; k < j; k++) ve.push_back(a[k]);
    sort(ve.begin(), ve.end(), cmp);
    int rem = h;
    for (int i = 0; i < j; i++) {
      if (i % 2 == 0) {
        rem -= ve[i];
      }
      if (rem < 0) {
        flag = 0;
        break;
      }
    }
    if (flag == 0) break;
  }
  if (flag == 0)
    printf("%d", j - 1);
  else
    printf("%d", n);
}
