#include <bits/stdc++.h>
using namespace std;
const int MOD = int(1e9) + 7;
const int INF = INT_MAX;
const long long INFF = INT64_MAX;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int moveX[] = {-1, 0, 1, 0};
const int moveY[] = {0, 1, 0, -1};
void solve() {
  int n, p, k;
  cin >> n >> p >> k;
  vector<int> goods;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    if (temp <= p) goods.push_back(temp);
  }
  sort(goods.begin(), goods.end());
  int myCount = 0, cur = p, tmp;
  if (goods.size() == 0) {
    cout << 0 << '\n';
    return;
  }
  myCount++;
  cur -= goods[0];
  for (int i = 2; i < goods.size(); i += 2) {
    if (cur >= goods[i]) {
      myCount += 2;
      cur -= goods[i];
    } else {
      cur += goods[0];
      myCount--;
      if (cur >= goods[i]) {
        myCount += 2;
      } else if (cur >= goods[i - 1] + goods[0])
        myCount += 2;
      else
        myCount++;
      break;
    }
  }
  cur = p;
  tmp = myCount;
  myCount = 0;
  for (int i = 1; i < goods.size(); i += 2) {
    if (cur >= goods[i]) {
      myCount += 2;
      cur -= goods[i];
    } else {
      cur += (goods[1] - goods[0]);
      myCount--;
      if (goods[i] <= cur) {
        myCount += 2;
      } else {
        myCount++;
      }
      break;
    }
  }
  myCount = max(myCount, tmp);
  cout << myCount << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
