#include <bits/stdc++.h>
using namespace std;
long long arr[1001];
long long temp[1001];
long long n, h;
long long th;
long long ans[1001];
int compare(const void* a, const void* b) {
  return (*(long long*)b - *(long long*)a);
}
int main(void) {
  cin >> n >> h;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; ++i) {
    th = h;
    memset(temp, 0, sizeof(temp));
    memcpy(temp, arr, sizeof(long long) * (i + 1));
    qsort(temp, i + 1, sizeof(long long), compare);
    for (int j = 0; j <= i; ++j) {
      if (j % 2 == 1) {
        ans[i]++;
        continue;
      }
      if (temp[j] > th) {
        break;
      } else {
        th -= temp[j];
        ans[i]++;
      }
    }
  }
  qsort(ans, n, sizeof(long long), compare);
  printf("%ld", ans[0]);
}
