#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
bool findfxn(string a, string b) {
  size_t found = a.find(b);
  if (found != string::npos)
    return 1;
  else
    return 0;
}
long long int power(long long int a, long long int b) {
  if (b == 0) {
    return 1;
  } else if (b % 2 == 0) {
    return power(a * a, b / 2);
  } else {
    return a * power(a * a, (b - 1) / 2);
  }
}
void solve() {
  long long int n, p, k, z = 0;
  cin >> n >> p >> k;
  int a[n];
  int sum[n + 10];
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int i = 0;
  for (i = 0; i < n; i++) {
    if (i > 1) {
      sum[i] = sum[i - 2] + a[i];
    } else
      sum[i] = a[i];
    if (sum[i] > p) {
      break;
    }
  }
  cout << i << endl;
  return;
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
  return 0;
}
