#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   const double pi = acos(-1);   const int inf = 1 << 30;   const int mod = 1e9 + 9;   struct point {     int x, flag;     bool operator<(const point &a) const { return flag > a.flag; }   } s, q;   bool check(long long a[], int n, long long h, int x) {     priority_queue<int, vector<int>, less<int> > qwe;     for (int i = 1; i <= min(n, x); i++) qwe.push(a[i]);     int f = 1, pos;     while (!qwe.empty()) {       pos = qwe.top();       qwe.pop();       if (f) h -= pos;       f ^= 1;     }     if (h >= 0ll)       return true;     else       return false;   }   int main() {     int n;     long long h, a[maxn];     scanf( %d %lld , &n, &h);     for (int i = 1; i <= n; i++) scanf( %lld , &a[i]);     int l = 0, r = n, ans = 0;     while (l <= r) {       int mid = (l + r) >> 1;       if (check(a, n, h, mid))         l = mid + 1, ans = mid;       else         r = mid - 1;     }     printf( %d n , ans);     return 0;   }   