#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, p, k;
  cin >> n >> p >> k;
  vector<int> a(n + 1), c(n + 1);
  for (int(i) = (int)(1); (i) <= (int)(n); ++(i)) cin >> a[i];
  sort(a.begin() + 1, a.end());
  if (p < a[1]) {
    cout << "0\n";
    return;
  }
  vector<int> dp(n + 1, 0);
  c[0] = p;
  dp[1] = 1, c[1] = p - a[1];
  for (int(i) = (int)(2); (i) <= (int)(n); ++(i)) {
    int tran = 0;
    for (int(j) = (int)(1); (j) <= (int)(2); ++(j))
      if (c[i - j] >= a[i] &&
          (dp[i] < dp[i - j] + j ||
           (dp[i] == dp[i - j] + j && c[i] < c[i - j] - a[i]))) {
        dp[i] = dp[i - j] + j;
        c[i] = c[i - j] - a[i];
        tran = 1;
      }
    if (tran == 0) {
      cout << max(dp[i - 1], dp[i - 2]) << '\n';
      return;
    }
  }
  cout << dp[n] << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int ntest;
  cin >> ntest;
  while (ntest--) solve();
  return 0;
}
