#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 1005;
long long a[N];
long long n, h;
vector<long long> v[1005];
multiset<long long> s;
inline void solve() {
  cin >> n >> h;
  long long k = 1;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    s.insert(a[i]);
    for (auto it : s) v[k].push_back(it);
    ++k;
  }
  long long lst = 1;
  for (long long i = 1; i < k; ++i) {
    long long ans = 0;
    for (long long j = (long long)v[i].size() - 1; j >= 0; j -= 2)
      ans += v[i][j];
    if (ans <= h) lst = i;
  }
  cout << lst;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  solve();
  return 0;
}
