#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, -1, -1, 1, 1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
template <class T>
inline T gcd(T a, T b) {
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
int possible(vector<int> &items, int k, int h) {
  vector<int> kitems;
  for (int i = 0; i < k; i++) {
    kitems.push_back(items[i]);
  }
  sort(kitems.rbegin(), kitems.rend());
  int sum = 0;
  for (int i = 0; i < k - 1; i = i + 2) {
    sum += max(kitems[i], kitems[i + 1]);
  }
  if (k % 2 != 0) {
    sum += kitems[k - 1];
  }
  return h >= sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, h;
  cin >> n >> h;
  vector<int> items;
  for (int i = 0; i < n; i++) {
    int item;
    cin >> item;
    items.push_back(item);
  }
  for (int i = 0; i < n; i++) {
    int pos = possible(items, i + 1, h);
    if (!pos) {
      cout << i << endl;
      return 0;
    }
  }
  cout << n << endl;
  return 0;
}
