#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 50;
const int M = 5e3 + 50;
int n, m, u, v, k, l, r, t, c;
int cnt, cnt1, cnt2, ans;
int mn = INT_MAX;
int mx = INT_MIN;
const int fx[9] = {0, 0, 1, -1, 0, 1, 1, -1, -1};
const int fy[9] = {1, -1, 0, 0, 0, 1, -1, 1, -1};
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
bool visited[N];
const int MOD = (1ll << 30);
int a[N];
bool cmp(pair<int, int> a, pair<int, int> b) {
  return abs(a.first) > abs(b.first);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int h;
  cin >> n >> h;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> b;
  for (int i = 0; i < n; i++) {
    int sum = 0;
    b.push_back(a[i]);
    sort(b.rbegin(), b.rend());
    for (int j = 0; j < b.size(); j++) {
      if (j % 2 == 0) {
        sum += b[j];
      }
      if (sum > h) {
        ans = 1;
        break;
      }
    }
    if (ans == 1) {
      break;
    }
    cnt = b.size();
  }
  cout << cnt;
}
