import java.io.*; import java.util.*; import java.util.stream.*; public class Main { static long[] weights; static long[] values; static ArrayList> dp; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int t = sc.nextInt(); StringBuilder sb = new StringBuilder(); while (t-- > 0) { int n = sc.nextInt(); long w = sc.nextLong(); weights = new long[n]; values = new long[n]; dp = new ArrayList<>(); for (int i = 0; i < n; i++) { weights[i] = sc.nextLong(); dp.add(new HashMap<>()); } values[0] = 1; if (n > 1) { values[1] = 2; } for (int i = 2; i < n; i++) { values[i] = values[i - 1] + values[i - 2]; } sb.append(dfw(n - 1, w)).append("\n"); } System.out.print(sb); } static long dfw(int idx, long w) { if (w < 0) { return Long.MIN_VALUE; } if (idx < 0) { return 0; } if (!dp.get(idx).containsKey(w)) { dp.get(idx).put(w, Math.max(dfw(idx - 1, w), dfw(idx - 1, w - weights[idx]) + values[idx])); } return dp.get(idx).get(w); } } class Utilities { static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }