#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5;
int a[maxn + 5];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long n, p, k;
    cin >> n >> p >> k;
    long long op = p;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    long long a1 = 0, a2 = 0;
    for (int i = 0; i < n; i += 2) {
      if (p < a[i]) break;
      p -= a[i];
      a1 += 2;
    }
    a1--;
    p = op;
    for (int i = 1; i < n; i += 2) {
      if (p < a[i]) break;
      p -= a[i];
      a2 += 2;
    }
    cout << max(a1, a2) << endl;
  }
  return 0;
}
