#include <iostream>
#include <fstream>

#define MAX_INT 2147483647

using namespace std;

int main()
{
	int testCount;

	fstream fin;

	fin.open("LADDER.IN");

	fin >> testCount;

	for(int i = 0; i < testCount; i++)
	{
		int N, K;
		fin >> N >> K;

		int *c = new int[N];

		for(int j = 0; j < N; j++)
		{
			fin >> c[j];
		}

		int curPos = 0;
		int curNum = 0;

		int minNum = MAX_INT;
		int minNumPos = 0;

		bool noWay = false;
		while(!noWay)
		{
			noWay = true;
			for(int j = curPos + 1; j <= curPos + K && j <= N; j++)
			{
				if(c[j - 1] > curNum && c[j - 1] <= minNum)
				{
					noWay = false;
					minNum = c[j - 1];
					minNumPos = j;
				}
			}
			if(!noWay)
			{
				curPos = minNumPos;
				curNum = minNum;
				minNum = MAX_INT;
			}
		}

		cout << curPos << endl;

		delete[] c;
	}

	fin.close();

	//getchar();

	return 0;
}