/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package codejam.common;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Lance Chen
 */
public class CodeHelper {

    private static String FILE_ROOT = "D:/workspace/googlecodejam/meta";

    public static List<List<String>> loadInputsExcludes(String fileName) {
        List<List<String>> result = new ArrayList<List<String>>();
        List<String> lines = FileUtil.readLines(FILE_ROOT + fileName);
        int index = 0;
        for (String line : lines) {
            if (index == 0) {
                index++;
                continue;
            }
            if (index % 2 == 1) {
                index++;
                continue;
            }
            List<String> dataList = new ArrayList<String>();
            String[] dataArray = line.split("\\s+");
            for (String data : dataArray) {
                if (data.trim().length() > 0) {
                    dataList.add(data);
                }
            }
            result.add(dataList);
            index++;
        }
        return result;
    }

    public static List<List<String>> loadInputs(String fileName) {
        List<List<String>> result = new ArrayList<List<String>>();
        List<String> lines = FileUtil.readLines(FILE_ROOT + fileName);
        for (String line : lines) {
            List<String> dataList = new ArrayList<String>();
            String[] dataArray = line.split("\\s+");
            for (String data : dataArray) {
                if (data.trim().length() > 0) {
                    dataList.add(data);
                }
            }
            result.add(dataList);
        }
        return result;
    }

    public static List<String> loadInputLines(String fileName) {
        return FileUtil.readLines(FILE_ROOT + fileName);
    }

    public static void writeOutputs(String fileName, List<String> lines) {
        FileUtil.writeLines(FILE_ROOT + fileName, lines);
    }
}

import java.util.Scanner;


public class Surp {

	/**
	 * @param args
	 */
	public static void main(String[] args) { 
		int T,S,p,N=0;
		String L="";
		Scanner b = new Scanner(System.in);
		T=b.nextInt();
		L=b.nextLine();
		for(int i=0;i<T;i++){
			L=b.nextLine();
			String F[]=L.split(" ");
			N=0;
			S=Integer.parseInt(F[1]);
			p=Integer.parseInt(F[2]);
			int min=p+2*(p-2);
			if(min<=1){
				min=p;
			}
			for(int j=3;j<F.length;j++){
					int val=Integer.parseInt(F[j]);
					if(min<=val){
						if(min+1<val||min==0)
							N++;
						else
							if(S>0){
								S--;
								N++;
							}
						}
				}
			System.out.println("Case #"+(i+1)+": "+N);
			}
		}
	

}
