#include <bits/stdc++.h>
using namespace std;
template <typename... T>
void read(T&... args) {
  ((cin >> args), ...);
}
void solve() {
  long long n, h;
  cin >> n >> h;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  long long k = h;
  for (long long i = 1; i <= n; i++) {
    long long v[i];
    for (long long j = 0; j < i; j++) v[j] = a[j];
    sort(v, v + i);
    for (long long u = i - 1; u >= 0; u = u - 2) {
      if (k >= v[u]) {
        k -= v[u];
      } else {
        cout << ans << endl;
        return;
      }
    }
    k = h;
    ans = i;
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
  solve();
  return 0;
}
