#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int i, j, n, h;
  cin >> n >> h;
  int a[500005];
  vector<pair<int, int> > bottles;
  for (i = 0; i < n; ++i) {
    cin >> a[i];
    bottles.emplace_back(a[i], i);
  }
  int ans = 0, f = 1;
  for (i = 0; i < n; ++i) {
    vector<int> temp;
    for (j = 0; j <= i; ++j) {
      temp.push_back(a[j]);
    }
    sort(temp.begin(), temp.end());
    int sum = 0;
    for (j = i; j >= 0; j -= 2) {
      sum += temp[j];
      if (sum > h) {
        f = 0;
        break;
      }
    }
    if (f == 0) {
      break;
    } else {
      ans = i;
    }
  }
  cout << ans + 1;
  return 0;
}
