#include < iostream >
//#include < windows.h >

using namespace std;

int main()
{
	freopen("ladder.in","r",stdin);
	int test;
	cin >> test;


	
	

	for(int t=0;t<test;t++)
	{
		int mas[100000]={0},res[100000]={0};
		int n,k;
		cin >> n >> k;

		for(int i =0 ; i< n;i++)
		{
			cin >> mas[i];
		}

		for(int i =0 ; i< k;i++)
		{
			res[i]=1;
		}

		int lastindex = k-1;
		for(int i =k; i< n;i++)
		{
			
			for(int j=i-1; j >= i-k; j--)
			{
				if(mas[i]>mas[j] && res[j]==1)
				{
					res[i]=1;
					lastindex=i;
					break;
				}
			}
		}
		cout << lastindex + 1<< endl;



	}


	//Sleep(3000);


}