#include <bits/stdc++.h>
using namespace std;
void boost() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int N = 1e6;
const long long inf = 1e18;
int n, a[1005];
int flag, h;
vector<int> v;
int main() {
  boost();
  cin >> n >> h;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    v.push_back(a[i]);
    sort(v.begin(), v.end());
    int sum = 0;
    for (int j = v.size() - 1; j >= 0; j -= 2) {
      sum += v[j];
    }
    if (sum > h) {
      cout << i - 1;
      return 0;
    }
  }
  cout << n;
}
