#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n, p, k;
    cin >> n >> p >> k;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    int final_sum = 0;
    int count = 0;
    for (int i = 1; i < n; i += 2) {
      if ((final_sum + a[i]) <= p) {
        final_sum += a[i];
        count += 2;
      } else
        break;
    }
    if (n % 2 != 0) {
      if ((final_sum + a[n - 1]) <= p) {
        count += 1;
      }
    }
    final_sum = 0;
    int count2 = 0;
    for (int i = 2; i < n; i += 2) {
      if ((final_sum + a[i]) <= p) {
        final_sum += a[i];
        count2 += 2;
      } else
        break;
    }
    if ((final_sum + a[0]) <= p) {
      final_sum += a[0];
      count2 += 1;
    }
    if (n % 2 == 0) {
      if ((final_sum + a[n - 1]) <= p) {
        count2 += 1;
      }
    }
    cout << max(count, count2) << endl;
  }
}
