#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, p, k, i, res = 0, temp;
    cin >> n >> p >> k;
    vector<long long> a(n);
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a.begin(), a.end());
    temp = p;
    for (i = 2; i < a.size(); i += 2) {
      if (p >= a[i]) {
        p -= a[i];
        res += 2;
      }
    }
    if (p >= a[0]) {
      p -= a[0];
      res++;
      if (a.size() % 2 == 0) {
        if (p >= a[a.size() - 1]) {
          res++;
        }
      }
    }
    p = temp;
    long long res2 = 0;
    for (i = 1; i < a.size(); i += 2) {
      if (p >= a[i]) {
        p -= a[i];
        res2 += 2;
      }
    }
    if (a.size() % 2 != 0) {
      if (p >= a[a.size() - 1]) {
        res2++;
      }
    }
    res = max(res2, res);
    cout << res << "\n";
  }
}
