#include <bits/stdc++.h>
using namespace std;
const int MAX_N = (2e5) + 5;
int solve(int* a, const int& n, const int& p, const int& start_idx) {
  int sol = 0;
  int money = p;
  int i = start_idx;
  while (i <= n) {
    if (i <= n - 1 && a[i + 1] <= money) {
      money -= a[i + 1];
      if (i > 0) {
        sol += 2;
      } else {
        sol += 1;
      }
      i += 2;
    } else if (a[i] <= money) {
      money -= a[i];
      if (i > 0) {
        sol += 1;
      }
      i += 1;
    } else {
      i = n + 1;
    }
  }
  return sol;
}
int greedy(int* a, const int& n, const int& p, const int& k, ostream& cout) {
  sort(a + 1, a + n + 1);
  a[0] = 0;
  int sol1 = solve(a, n, p, 1);
  int sol2 = solve(a, n, p, 0);
  return max(sol1, sol2);
}
int main(int argc, char** argv) {
  int t, n, p, k;
  int a[MAX_N];
  cin >> t;
  for (; t > 0; --t) {
    cin >> n >> p >> k;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
    }
    cout << greedy(a, n, p, k, cout) << "\n";
  }
  return 0;
}
