// Arup Guha
// 2/25/2020
// Solution to 2020 UCF HS Contest Problem: Bigloo Building

import java.util.*;

public class bigloo {

    public static void main(String[] args) {

        Scanner stdin = new Scanner(System.in);
        int nC = stdin.nextInt();

		// Process each case.
        for (int loop=0; loop<nC; loop++) {

			// Get basic parameters.
            int n = stdin.nextInt();
            int k = stdin.nextInt();

			// Create cumulative frequency array of the data.
            int[] freq = new int[10000001];
            for (int i=0; i<n; i++)
                freq[stdin.nextInt()]=1;
            for (int i=1; i<=10000000; i++)
                freq[i] += freq[i-1];

			// We are looking for the largest interval where there is one of each size,
			// so the cumulative frequency in the range of size k will be k.
            int res = -1;
            for (int i=10000000; i-k>=0; i--) {
                if (freq[i]-freq[i-k] == k) {
                    res = i;
                    break;
                }
            }

			// Oops, can't do it.
            if (res == -1)
                System.out.println("We're gonna freeze out here!");
            
			// Our largest answer.
			else
                System.out.println(res);
        }
    }
}