#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long left = 0, right = n - 1;
  long long ansIndex, finalAns;
  long long tem;
  for (long long f = 0; f < n; f++) {
    vector<long long> temp;
    int flag = 0, red = 0;
    for (long long i = 0; i <= f; i++) {
      temp.push_back(arr[i]);
    }
    sort(temp.begin(), temp.end(), greater<long long>());
    long long si = temp.size();
    long long sum = 0;
    for (long long i = 0; i < si; i += 2) {
      sum += temp[i];
      if (sum > k) {
        finalAns = tem;
        flag = 1;
        break;
      } else if (sum <= k) {
        ansIndex = f;
      }
    }
    tem = ansIndex;
    if (flag == 1) {
      break;
    }
  }
  cout << finalAns + 1 << "\n";
  return 0;
}
