#include <bits/stdc++.h>
using namespace std;
struct compare {
  bool operator()(const int64_t &a, const int64_t &b) { return a > b; }
};
bool customS(pair<int64_t, int64_t> a, pair<int64_t, int64_t> b) {
  if (a.first == b.first) return a.second > b.second;
  return a.first < b.first;
}
bool customS2(pair<int64_t, int64_t> a, pair<int64_t, int64_t> b) {
  return a.second < b.second;
}
class CompareDist {
 public:
  bool operator()(pair<int64_t, int64_t> a, pair<int64_t, int64_t> b) {
    return a.first < b.first;
  }
};
int64_t gcd(int64_t a, int64_t b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
double gcdfloat(double a, double b) {
  if (a < b) return gcd(b, a);
  if (fabs(b) < 0.001)
    return a;
  else
    return (gcd(b, a - floor(a / b) * b));
}
void DFS(int64_t start, vector<vector<int64_t> > &nodes,
         vector<int64_t> &visited, int64_t *a, int64_t *b, int64_t ctr) {
  visited[start] = 1;
  if (ctr % 2 == 0)
    *a = *a + 1;
  else
    *b = *b + 1;
  for (int i = 0; i < nodes[start].size(); i++) {
    if (visited[nodes[start][i]] == 0) {
      DFS(nodes[start][i], nodes, visited, a, b, ctr + 1);
    }
  }
}
int64_t LCA(int64_t a, int64_t b) {
  while (a != b) {
    if (b > a) {
      swap(a, b);
    }
    a /= 2;
  }
  return a;
}
vector<int64_t> ra(int64_t n) {
  vector<int64_t> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  return arr;
}
int64_t binary_search_lower(vector<int64_t> &arr, int64_t n) {
  int64_t low = 0, high = arr.size() - 1, mid, ans = -1;
  while (low <= high) {
    mid = (low + high) / 2;
    if (arr[mid] <= n) {
      ans = mid;
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  return ans;
}
int64_t binary_search_upper(vector<int64_t> &arr, int64_t n) {
  int64_t low = 0, high = arr.size() - 1, mid, ans = -1;
  while (low <= high) {
    mid = (low + high) / 2;
    if (arr[mid] >= n) {
      ans = mid;
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int trial;
  cin >> trial;
  while (trial--) {
    int64_t i, j, a = 0, b = 0, c = 0, d = 0, n, m, k, sum = 0, x = 0, y = 0,
                  z = 0, flag = 0, zero = 0, ans = 0;
    int64_t mod = 1000000007;
    string s, newS, s2;
    double dn;
    int64_t p;
    cin >> n >> p >> k;
    vector<int64_t> arr = ra(n);
    sort(arr.begin(), arr.end());
    x = p, y = 0, i = 0;
    while (x > 0 && i < n && arr[i] <= x) {
      x -= arr[i];
      if (i == 0)
        y++;
      else
        y += 2;
      i += 2;
    }
    x = p, z = 0, i = 1;
    while (x > 0 && i < n && arr[i] <= x) {
      x -= arr[i];
      i += 2;
      z += 2;
    }
    cout << max(y, z) << "\n";
  }
  return 0;
}
