import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: student
 * Date: 30.05.11
 * Time: 11:07
 * To change this template use File | Settings | File Templates.
 */
public class SD {
    public static void main(String []args) throws IOException{
        BufferedReader reader = new BufferedReader(new FileReader("LADDER.IN"));
        Integer T=Integer.parseInt(reader.readLine().toString());
        int counter=0;
        while(counter<T){
            String s;
            while ((s=reader.readLine())!=null){
                String[] k=s.split(" ");
                Integer N=Integer.parseInt(k[0]);
                Integer U=Integer.parseInt(k[1]);

              long[] array= new long[N];
                int [] array1= new int[N];
                s=reader.readLine();
                k=s.split(" ");
                for(int i=0;i<N;i++)
                    array[i]=Integer.parseInt(k[i]);
                for(int i=0;i<U;i++)
                    array1[i]=0;
                for(int i=U;i<N;i++ ){
                    array1[i]=i;
                    for(int j=0;j<U;j++){

                        if(array[i-j]<array[i]&& array1[i-j]<array1[i]){
                            array1[i]=array1[i-j];

                        }
                    }
                }
                int outindex=0;
                for(int i=N-1;i>0;i--){
                    if (array1[i]==0)
                    {
                        outindex=i;
                        break;
                    }
                }
                System.out.println(outindex+1);
                counter++;

            }

        }
    }
}
