#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, m;
int main(void) {
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = n; i >= 0; --i) {
    vector<int> v(a.begin(), a.begin() + i);
    sort(v.begin(), v.end());
    long long res = 0;
    for (int j = int(v.size()) - 1; j >= 0; j -= 2) res += v[j];
    if (res <= m) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}
