#include <bits/stdc++.h>
const int Inf = 2 * 1000 * 1000 * 1000;
long long LINF = (long long)4e18;
using namespace std;
bool ok(vector<int> &a, int h, int k) {
  vector<int> tmp;
  for (int i = 0; i <= k; i++) tmp.emplace_back(a[i]);
  sort((tmp).rbegin(), (tmp).rend());
  for (int i = 0; i <= k; i += 2) {
    h -= tmp[i];
    if (h < 0) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, h;
  cin >> n >> h;
  vector<int> a(n);
  for (auto &x : a) cin >> x;
  for (int i = n - 1; i >= 0; i--) {
    if (ok(a, h, i)) {
      cout << i + 1;
      return 0;
    }
  }
  return 0;
}
