#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  long long h;
  cin >> n >> h;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  if (n == 1 || n == 2) {
    cout << n;
    return 0;
  }
  long long res = 2;
  for (long long i = 2; i < n; i++) {
    vector<long long> v;
    for (long long j = i; j >= 0; j--) {
      v.push_back(arr[j]);
    }
    sort(v.begin(), v.end());
    long long len = v.size();
    if (len % 2 == 0) {
      long long ans = 0;
      for (long long k = 1; k < len; k += 2) {
        ans += v[k];
      }
      if (ans <= h)
        res += 1;
      else {
        break;
      }
    } else {
      long long ans = 0;
      for (long long k = 0; k < len; k += 2) {
        ans += v[k];
      }
      if (ans <= h)
        res += 1;
      else {
        break;
      }
    }
  }
  cout << res;
  return 0;
}
