#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, p, k;
    cin >> n >> p >> k;
    int a[n];
    int pp = p;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    int gifts = 0;
    int gifts2 = 0;
    if (p >= a[0]) {
      gifts++;
      p = p - a[0];
    }
    for (int i = 2; i < n; i = i + 2) {
      if (p >= a[i]) {
        gifts += 2;
        p = p - a[i];
      } else
        break;
    }
    for (int i = 1; i < n; i = i + 2) {
      if (pp >= a[i]) {
        gifts2 += 2;
        pp = pp - a[i];
      } else
        break;
    }
    gifts = (gifts > gifts2) ? gifts : gifts2;
    cout << gifts << endl;
  }
  return 0;
}
