#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, p, k;
    cin >> n >> p >> k;
    vector<int> ch;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      ch.push_back(x);
    }
    long long sum1 = 0, sum2 = 0;
    sort(ch.begin(), ch.end());
    int tk1 = p, tk2 = p;
    if (tk1 >= ch[0]) {
      sum1 += 1;
      tk1 = tk1 - ch[0];
    }
    for (int i = 1; i < n; i += 2) {
      if (tk2 >= ch[i]) {
        sum2 += 2;
        tk2 = tk2 - ch[i];
      } else if (tk2 >= ch[i - 1]) {
        sum2 += 1;
        tk2 -= ch[i - 1];
      }
      if (i + 1 < n && tk1 >= ch[i + 1]) {
        sum1 += 2;
        tk1 -= ch[i + 1];
      } else if (tk1 >= ch[i]) {
        sum1 += 1;
        tk1 -= ch[i];
      }
    }
    cout << max(sum1, sum2) << endl;
  }
  return 0;
}
