#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000000")
using namespace std;
const int INF = 1000000007;
const long long INF2 = 1000000000000000007;
const long long MOD = 1000000007;
const long long MOD1 = 1864463441;
const int SIZE = 200010;
const double eps = 1e-6;
uniform_int_distribution<int> uid(1, 2);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long t, n, k, q, a, b, c, p, r, p1, ar[SIZE], k1, k2, cur, ar1[SIZE];
vector<long long> vec;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> p >> k;
    p1 = p;
    for (int i = 0; i < n; ++i) {
      cin >> ar[i];
    }
    sort(ar, ar + n);
    k1 = 0;
    k2 = 0;
    for (int i = 1; i < n; i += 2) {
      if (ar[i] <= p) {
        p -= ar[i];
        k1 += 2;
      } else if (ar[i - 1] <= p) {
        k1++;
        p -= ar[i - 1];
        break;
      }
    }
    if (p1 >= ar[0]) {
      p1 -= ar[0];
      k2++;
    }
    for (int i = 2; i < n; i += 2) {
      if (ar[i] <= p1) {
        p1 -= ar[i];
        k2 += 2;
      } else if (ar[i - 1] <= p1) {
        k2++;
        p1 -= ar[i - 1];
        break;
      }
    }
    cout << max(k2, k1) << endl;
  }
  return 0;
}
