#include <iostream>
#include <bits/stdc++.h>
#define Yosry ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define ll long long
using namespace std;
void solve() {
int n , k ;
cin >> n >> k ;
map<int,int> freq;
vector<int> v(n);
deque<int> dq,after;
for (int i = 0; i < n; ++i) {
cin >> v[i];
freq[v[i]]++;
if (freq[v[i]]==k){
dq.push_front(v[i]);
}
}
if (dq.empty()){
cout<< -1 <<endl;
return;
}
std::sort(dq.begin(), dq.end());
int bestl{} , bestr{},l=0 , r=0;
while (!dq.empty()){
if (after.empty()){
after.push_back(dq.front());
dq.pop_front();
}
else if (dq.front()-after.back()>1){
l = after.front();
r = after.back();
if (!bestl||r-l>bestr-bestl){
bestr=r;
bestl=l;
}
after.clear();
}
else {
after.push_back(dq.front());
dq.pop_front();
}
}
if (!after.empty()){
l = after.front();
r = after.back();
if (!bestl||r-l>bestr-bestl){
bestr=r;
bestl=l;
}
}
cout << bestl<<" "<< bestr<<endl;
}
signed main() {
Yosry
int t=1;
cin >> t;
while (t--) {
solve();
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBZb3NyeSBpb3M6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSksIGNpbi50aWUobnVsbHB0ciksIGNvdXQudGllKG51bGxwdHIpOwojZGVmaW5lIGxsIGxvbmcgbG9uZwp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKCgp2b2lkIHNvbHZlKCkgewogICAgaW50ICBuICwgayA7CiAgICBjaW4gPj4gbiA+PiBrIDsKICAgIG1hcDxpbnQsaW50PiBmcmVxOwogICAgdmVjdG9yPGludD4gdihuKTsKICAgIGRlcXVlPGludD4gZHEsYWZ0ZXI7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgICAgIGNpbiA+PiB2W2ldOwogICAgICAgIGZyZXFbdltpXV0rKzsKICAgICAgICBpZiAoZnJlcVt2W2ldXT09ayl7CiAgICAgICAgICAgIGRxLnB1c2hfZnJvbnQodltpXSk7CiAgICAgICAgfQogICAgfQogICAgaWYgKGRxLmVtcHR5KCkpewogICAgICAgIGNvdXQ8PCAtMSA8PGVuZGw7CiAgICAgICAgcmV0dXJuOwogICAgfQogICAgc3RkOjpzb3J0KGRxLmJlZ2luKCksIGRxLmVuZCgpKTsKCiAgICBpbnQgYmVzdGx7fSAsIGJlc3Rye30sbD0wICwgcj0wOwogICAgd2hpbGUgKCFkcS5lbXB0eSgpKXsKICAgICAgICBpZiAoYWZ0ZXIuZW1wdHkoKSl7CiAgICAgICAgICAgIGFmdGVyLnB1c2hfYmFjayhkcS5mcm9udCgpKTsKICAgICAgICAgICAgZHEucG9wX2Zyb250KCk7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKGRxLmZyb250KCktYWZ0ZXIuYmFjaygpPjEpewogICAgICAgICAgICBsID0gYWZ0ZXIuZnJvbnQoKTsKICAgICAgICAgICAgciA9IGFmdGVyLmJhY2soKTsKICAgICAgICAgICAgaWYgKCFiZXN0bHx8ci1sPmJlc3RyLWJlc3RsKXsKICAgICAgICAgICAgICAgIGJlc3RyPXI7CiAgICAgICAgICAgICAgICBiZXN0bD1sOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGFmdGVyLmNsZWFyKCk7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICBhZnRlci5wdXNoX2JhY2soZHEuZnJvbnQoKSk7CiAgICAgICAgICAgIGRxLnBvcF9mcm9udCgpOwogICAgICAgIH0KICAgIH0KICAgIGlmICghYWZ0ZXIuZW1wdHkoKSl7CiAgICAgICAgbCA9IGFmdGVyLmZyb250KCk7CiAgICAgICAgciA9IGFmdGVyLmJhY2soKTsKICAgICAgICBpZiAoIWJlc3RsfHxyLWw+YmVzdHItYmVzdGwpewogICAgICAgICAgICBiZXN0cj1yOwogICAgICAgICAgICBiZXN0bD1sOwogICAgICAgIH0KICAgIH0KICAgIGNvdXQgPDwgYmVzdGw8PCIgIjw8IGJlc3RyPDxlbmRsOwp9CgpzaWduZWQgbWFpbigpIHsKICAgIFlvc3J5CiAgICBpbnQgdD0xOwogICAgY2luID4+IHQ7CiAgICB3aGlsZSAodC0tKSB7CiAgICAgICAgc29sdmUoKTsKICAgIH0KfQo=