#include<bits/stdc++.h>
using namespace std;
long vitri(long n, long k, long a[])
{
long dau = 0;
long cuoi = n-1;
while (dau < cuoi)
{
long giua = (dau +cuoi) / 2;
if (k == a[giua]) return giua;
if (k< a[giua]) cuoi = giua -1;
else
if (k>a[giua]) dau = giua +1;
}
return -1;
}
int main()
{
int t;
cin >> t;
while (t--)
{
long n, k;
cin >> n >> k;
long a[n];
for (int i = 1; i<=n ;i++)
{
cin >> a[i];
}
long u = vitri(n,k,a);
if (u >= 0) cout << u;
else cout << "NO";
cout << endl;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKbG9uZyB2aXRyaShsb25nIG4sIGxvbmcgaywgbG9uZyBhW10pCnsKCWxvbmcgZGF1ID0gMDsKCWxvbmcgY3VvaSA9IG4tMTsKCXdoaWxlIChkYXUgPCBjdW9pKQoJewoJCWxvbmcgZ2l1YSA9IChkYXUgK2N1b2kpIC8gMjsKCQlpZiAoayA9PSBhW2dpdWFdKSByZXR1cm4gZ2l1YTsKCQlpZiAoazwgYVtnaXVhXSkgY3VvaSA9IGdpdWEgLTE7CgkJZWxzZSAKCQlpZiAoaz5hW2dpdWFdKSBkYXUgPSBnaXVhICsxOwoJCX0KCXJldHVybiAtMTsKfQppbnQgbWFpbigpCnsKCWludCB0OwoJY2luID4+IHQ7Cgl3aGlsZSAodC0tKQoJewoJCWxvbmcgbiwgazsKCQljaW4gPj4gbiA+PiBrOwoJCWxvbmcgYVtuXTsKCQlmb3IgIChpbnQgaSA9IDE7IGk8PW4gO2krKykKCQl7CgkJCWNpbiA+PiBhW2ldOwoJCX0KCQlsb25nIHUgPSB2aXRyaShuLGssYSk7CgkJaWYgKHUgPj0gMCkgY291dCA8PCB1OwoJCWVsc2UgY291dCA8PCAiTk8iOwoJCWNvdXQgPDwgZW5kbDsKCX0KCXJldHVybiAwOwp9