#include <iostream>
#include <deque>

using namespace std;

int main(){
	freopen ("LADDER.IN","r",stdin);

	int am_tests;
	cin>>am_tests;

	for (int test=0;test<am_tests;test++){
		
		__int64 n,k,A[10001]={0},buf=0,bufJ=0;
		
		
		cin>>n>>k;

		for (int i=0;i<n;i++)
			cin>>A[i];

		__int64 min=A[0];

		for (int j=0;j<k;j++){
			if (A[j]<min){
				min = A[j];
				
			}
			buf=min;
			bufJ=j;
		}

		bool fl=false,fl2=false;
		for (int i=bufJ;i<n;i++){
			min = 10000000000;

			for (int j=1;j<=k;j++){
				if (buf<A[i+j] && A[i+j]<min){
					min=A[i+j];
					bufJ=i+j;
					fl2=true;
				}
				else
					if (j==k && !fl2)
						fl=true;
				
			}
			buf=min;	
			i+=bufJ;
			if (fl) break;
		}

		cout<<bufJ+1<<endl;
		

	}
	return 0;
}