#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long int MOD = 1e9 + 7;
const int N = 200005;
long long int fact[N];
long long int n, p, k;
long long int dp[N], arr[N];
long long int f(long long int in, long long int rem) {
  if (in >= n || rem <= 0) return 0;
  if (dp[in] != -1) return dp[in];
  long long int a = 0, b = 0, c = 0;
  if (rem >= arr[in]) {
    if (in + 2 <= n - 1)
      a = 2 + f(in + 2, rem - arr[in]);
    else
      a = 1 + f(in + 1, rem - arr[in]);
  }
  b = f(in + 1, rem);
  cout << "a = " << a << " b = " << b << endl;
  return dp[in] = max(a, b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
read:
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> p >> k;
    arr[0] = 0;
    for (int i = 1; i <= n; i++) cin >> arr[i];
    sort(arr, arr + n + 1);
    long long int ans = 0, ans1 = 0, rem = p;
    for (int i = 1; i <= n; i += 2) {
      if (rem >= arr[i]) {
        if (i == 1)
          ans += 1;
        else
          ans += 2;
        rem -= arr[i];
      }
    }
    for (int i = 2; i <= n; i += 2) {
      if (p >= arr[i]) {
        ans1 += 2;
        p -= arr[i];
      }
    }
    cout << max(ans, ans1) << endl;
  }
}
