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