#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long n, p, k, t, res, a[200007], dp[200007][2], ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> t;
  while (t--) {
    cin >> n >> p >> k;
    for (long int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    dp[0][0] = a[0];
    dp[0][1] = 1e10;
    dp[1][0] = a[0] + a[1];
    dp[1][1] = a[1];
    for (long int i = 2; i < n; i++) {
      dp[i][0] = min(dp[i - 1][0] + a[i], dp[i - 1][1] + a[i]);
      dp[i][1] = min(dp[i - 2][1] + a[i], dp[i - 2][0] + a[i]);
    }
    ans = -1;
    for (long int i = 0; i < n; i++)
      if (dp[i][0] <= p || dp[i][1] <= p) ans = i;
    cout << ans + 1 << "\n";
  }
}
