#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, p, k, i;
    cin >> n >> p >> k;
    int arr[n], sum[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    for (i = 0; i < n; i++) {
      if (i > 1)
        sum[i] = arr[i] + sum[i - 2];
      else
        sum[i] = arr[i];
      if (sum[i] > p) break;
    }
    cout << i << endl;
  }
}
