#include <bits/stdc++.h>
using namespace std;
int d4x[4] = {1, 0, -1, 0};
int d4y[4] = {0, 1, 0, -1};
int d8x[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int d8y[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long oo = 1e18;
const long long maxN = 1e6;
void maximize(int &a, int b) { a = max(a, b); }
void minimize(int &a, int b) { a = min(a, b); }
long long a[maxN];
void solve() {
  int n;
  long long h;
  vector<long long> v;
  cin >> n >> h;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    long long ans = 0;
    v.push_back(a[i]);
    sort(v.begin(), v.end());
    int ok = 1;
    for (int j = v.size() - 1; j >= 0; j--) {
      if (ok) ans += v[j];
      ok ^= 1;
    }
    if (ans > h) {
      cout << i - 1;
      return;
    }
  }
  cout << n;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
