#include <bits/stdc++.h>
using namespace std;
int t, n, p, k;
const int maxn = 2e5 + 10;
int a[maxn];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n >> p >> k;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    sort(a + 1, a + 1 + n);
    int ans = 0;
    int p1 = p;
    for (int i = 2; i <= n; i += 2) {
      if (p >= a[i]) {
        p -= a[i];
        ans += 2;
      }
    }
    if ((n & 1) && p >= a[n]) ++ans;
    int ans2 = 0;
    if (p1 >= a[1]) {
      ++ans2;
      p1 -= a[1];
    }
    for (int i = 3; i <= n; i += 2) {
      if (p1 >= a[i]) {
        p1 -= a[i];
        ans2 += 2;
      }
    }
    if (n % 2 == 0 && p1 >= a[n]) ++ans2;
    cout << max(ans, ans2) << endl;
  }
  return 0;
}
