#include <bits/stdc++.h>
#pragma optimizitaion_level 3
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
using namespace std;
int n, h;
vector<int> b;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> h;
  b.resize(n);
  for (auto &i : b) cin >> i;
  for (int i = 0; i < n; i++) {
    vector<int> now(i + 1);
    for (int j = 0; j <= i; j++) {
      now[j] = b[j];
    }
    sort(now.rbegin(), now.rend());
    int free = h;
    for (int j = 0; j <= i; j += 2) {
      if (free >= now[j]) {
        free -= now[j];
      } else
        return cout << i << '\n', 0;
    }
  }
  cout << n << '\n';
  return 0;
}
