#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 5;
long long int a[N];
int32_t main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, p, k, ctr = 0;
    cin >> n >> p >> k;
    for (long long int i = 0; i < n; i++) cin >> a[i];
    vector<long long int> dp(n, 0);
    vector<long long int> price(n, 0);
    sort(a, a + n);
    if (a[0] <= p) {
      dp[0] = 1;
      price[0] = p - a[0];
    } else
      price[0] = p;
    if (a[1] <= p) {
      dp[1] = 2;
      price[1] = p - a[1];
    } else {
      dp[1] = dp[0];
      price[1] = price[0];
    }
    for (long long int i = 2; i < n; i++) {
      if (a[i] <= price[i - 2]) {
        dp[i] = 2 + dp[i - 2];
        price[i] = price[i - 2] - a[i];
      } else {
        dp[i] = dp[i - 1];
        price[i] = price[i - 1];
      }
    }
    cout << dp[n - 1] << endl;
  }
}
