#include <iostream>
#include <cmath>
#include <vector>
#define EPS 0.000000001
using namespace std;


int main()
{
	freopen("LADDER.IN", "r", stdin);
	int t;
	cin >> t;
	while (t--)
	{
		int n, k;
		cin >> n >> k;
		vector<__int64> arr(n);
		for (int i = 0; i < n; ++i) {
			cin >> arr[i];
		}
		int last_min = 0, step = 1, index = 0;
		int i = 0, gindex = 0;
		while (i < n) {
			int cur_min = 1000000, index=-1;
			for (int j = i ; j < min(i+k, n); ++j) {
				if (cur_min >= arr[j] && arr[j] > last_min) {
					cur_min = arr[j];
					index = j;
					gindex = index;
				}
				
			}
			if (index == -1)
				break;
			last_min = cur_min;
			i = index + 1;
		}
		cout << gindex + 1 << endl;
	}
	return 0;
}