#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, p, k;
  cin >> n >> p >> k;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  vector<long long> dp(n, -1);
  dp[0] = a[0];
  dp[1] = a[1];
  long long i = 2;
  while (i < n) {
    dp[i] = min(dp[i - 2] + a[i], dp[i - 1] + a[i]);
    i++;
  }
  for (int i = 0; i < n; i++) {
    if (dp[i] > p) {
      cout << i << "\n";
      return;
    }
  }
  cout << n << "\n";
}
int main() {
  int q = 1;
  cin >> q;
  while (q--) solve();
}
