#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, h;
  cin >> n >> h;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    vector<long long int> op;
    for (long long int j = 0; j <= i; j++) op.push_back(arr[j]);
    sort(op.begin(), op.end());
    if (op.size() == 1) {
      if (op[0] <= h) ans = i + 1;
      continue;
    }
    long long int sum = 0;
    for (long long int j = op.size() - 1; j >= 0; j -= 2) sum += op[j];
    if (sum <= h)
      ans = i + 1;
    else
      break;
  }
  cout << ans << endl;
  return 0;
}
