#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000002;
const int MOD2 = 998244353;
const int MOD = 1000000007;
const int INF = 1e8;
const long double EPS = 1e-7;
long long int fastpow(long long int n, long long int x) {
  if (x == 0) return 1;
  if (x % 2 == 0) return (fastpow(n * n % MOD2, x / 2) % MOD2);
  return (x * fastpow(n * n % MOD2, (x - 1) / 2) % MOD2) % MOD2;
}
int main(int argc, char** argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  {
    long long int n, h, i, sum = 0, ans = 0;
    cin >> n >> h;
    long long int a[n];
    for (int i = 0; i < (int)n; i++) cin >> a[i];
    vector<long long int> v;
    for (int i = 0; i < (int)n; i++) {
      sum = 0;
      for (int j = 0; j < (int)i + 1; j++) {
        v.push_back(a[j]);
      }
      sort(v.begin(), v.end());
      for (int k = v.size() - 1; k >= 0; k -= 2) {
        sum += v[k];
      }
      if (sum <= h) {
        ans = v.size();
      }
      v.clear();
    }
    cout << ans << "\n";
  }
  return 0;
}
