#include <bits/stdc++.h>
using namespace std;
int t;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t) {
    t--;
    int n, p, k;
    cin >> n >> p >> k;
    int arr[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    sort(arr, arr + n);
    int tmp1 = 0, tmp2 = 0;
    int ans1 = 0, ans2 = 0;
    for (int i = 0; i < n; i++) {
      if (i % 2) {
        if (tmp1 + arr[i] <= p) {
          tmp1 += arr[i];
          ans1 = i + 1;
        }
      } else {
        if (tmp2 + arr[i] <= p) {
          tmp2 += arr[i];
          ans2 = i + 1;
        } else {
          break;
        }
      }
    }
    cout << max(ans1, ans2) << endl;
  }
  return 0;
}
