#include <bits/stdc++.h>
using namespace std;
signed solve() {
  long long g;
  cin >> g;
  long long c;
  cin >> c;
  long long k;
  cin >> k;
  vector<long long> v;
  long long input;
  for (long long i = 0; i < g; i++) {
    cin >> input;
    v.push_back(input);
  }
  v.push_back(pow(10, 9) * 2 + 1);
  v.push_back(pow(10, 9) * 2 + 1);
  g += 2;
  std::sort(v.begin(), v.end());
  long long sumo = v[0], no = 1;
  if (v[0] > c) {
    cout << 0 << endl;
    return 0;
  }
  for (long long i = 2; i < g; i += 2) {
    sumo += v[i];
    if (sumo > c) {
      no = (i - 1);
      break;
    }
  }
  long long sume = 0, ne = 0;
  for (long long i = 1; i < g; i += 2) {
    sume += v[i];
    if (sume > c) {
      ne = (i - 1);
      break;
    }
  }
  cout << max(no, ne) << endl;
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t-- > 0) {
    solve();
  }
  return 0;
}
