#include <stdio.h>
#include <iostream>
#include <memory.h>

using namespace std;


void solve()
{
    int N,K;

    cin >> N >> K;

    int a[100500];
    bool b[100500];

    memset(b,0,sizeof(b));

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

    for(int i = 0; i < K; i++) b[i] = true;
    int last = K;
    for(int i = K; i < N; i++)
    {
        for(int j = 0; j <= K; j++)
            b[i] = b[i] || ( b[i-j] && (a[i] > a[i-j])  );
        if(b[i]) last = i+1;
    }

     //for(int i = 0; i < N; i++) cout << b[i] << " ";
    cout << last << endl;
    //cout << dx << " " << dy << endl;

}

int main()
{
    //fstream fin("SHADOOF.IN");
    freopen("LADDER.IN", "r",stdin);
    int n;
    cin >> n;

    for(int ii = 0; ii < n; ++ii)
    {
        solve();
    }

    return 0;
}
