#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
bool isSubSequence(string str1, string str2, int m, int n) {
  if (m == 0) return true;
  if (n == 0) return false;
  if (str1[m - 1] == str2[n - 1])
    return isSubSequence(str1, str2, m - 1, n - 1);
  return isSubSequence(str1, str2, m, n - 1);
}
int main() {
  fast();
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int n, p, k;
    cin >> n >> p >> k;
    vector<long long int> v;
    long long int i, x;
    for (i = 0; i < n; i++) {
      cin >> x;
      v.push_back(x);
    }
    sort(v.begin(), v.end());
    long long int ans = 0;
    long long int left = p;
    vector<long long int> possible;
    if (v[0] > left) {
      cout << 0 << endl;
    } else if (v[0] == left) {
      if (n >= 2 && v[0] == v[1]) {
        cout << 2 << endl;
      } else {
        cout << 1 << endl;
      }
    } else {
      ans = 1;
      left -= v[0];
      vector<long long int> temp;
      for (i = 2; i < n; i += 2) {
        temp.push_back(v[i]);
      }
      if (temp.size() == 0) {
        if (p >= v[1]) {
          cout << 2 << endl;
          continue;
        } else {
          cout << 1 << endl;
          continue;
        }
      } else {
        if (v[n - 1] == temp[temp.size() - 1]) {
          for (i = 0; i < temp.size(); i++) {
            if (left >= temp[i]) {
              left -= temp[i];
              ans += 2;
            }
          }
          possible.push_back(ans);
        } else {
          for (i = 0; i < temp.size(); i++) {
            if (left >= temp[i]) {
              left -= temp[i];
              ans += 2;
            }
          }
          if (left >= v[n - 1]) {
            ans += 1;
          }
          possible.push_back(ans);
        }
      }
      ans = 0;
      left = p;
      for (i = 1; i < n; i += 2) {
        if (left >= v[i]) {
          ans += 2;
          left -= v[i];
        }
      }
      possible.push_back(ans);
      sort(possible.begin(), possible.end());
      cout << possible[possible.size() - 1] << endl;
    }
  }
  return 0;
}
