import collections
for _ in range(int(input())):
_, k = map(int, input().split())
c = collections.Counter(sorted(map(int, input().split())))
d = collections.Counter()
for i, x in c.items():
if x >= k:
d[i] = d[i - 1] + 1
if not d:
print(-1)
continue
r, u = d.most_common(1)[0]
print(r - u + 1, r)
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <list>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#include <tuple>
#include <deque>
#include <fstream>
using namespace std;
typedef long long ll;
typedef string str;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<list<int>> vli;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, int>> vpli;
typedef vector<pair<long long, long long>> vpll;
typedef vector<vector<pair<int, int>>> vvpi;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvll;
typedef vector<string> vs;
typedef vector<priority_queue<int>> vpqi;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<set<int>> vsi;
typedef vector<long double> vld;
typedef vector<vector<long double>> vvld;
typedef pair<int, int> pii;
typedef pair<int, str> pis;
typedef pair<str, int> psi;
typedef vector<pair<int, str>> vpis;
typedef vector<pair<str, int>> vpsi;
typedef vector<tuple<int, int, int>> vti;
typedef vector<tuple<long long, long long, long long>> vtll;
typedef pair<long long, long long> pll;
typedef pair<str, str> pss;
typedef priority_queue<int> pqi;
typedef priority_queue<long long> pqll;
typedef priority_queue<pair<int, int>> pqpi;
typedef priority_queue<int, vector<int>, greater<int>> rpqi;
typedef priority_queue<long long, vector<long long>, greater<long long>> rpqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpql;
typedef priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> rpqpi;
#define F first
#define S second
#define B begin()
#define E end()
#define LB(a) lower_bound(a)
#define UB(a) upper_bound(a)
#define PB push_back
#define I insert
#define FO(i, a, n) for (int i = a; i < n; ++i)
#define FO2(i, a, n) for (int i = a; i > n; --i)
#define FO3(i, a, n) for (int i = a; i <= n; ++i)
#define FO4(i, a, n) for (int i = a; i >= n; --i)
#define FD(i, a, n, b) for (int i = a; i < n; i += b)
#define FD2(i, a, n, b) for (int i = a; i > n; i -= b)
#define N '\n'
#define CN cout << "NO\n"
#define CY cout << "YES\n"
#define Cn cout << "No\n"
#define Cy cout << "Yes\n"
#define R(a) return a
#define SS(a) sort(a.begin(), a.end())
#define RSS(a) sort(a.rbegin(), a.rend())
#define SSC(a, comp) sort(a.begin(), a.end(), comp)
#define RSSC(a, comp) sort(a.rbegin(), a.rend(), comp)
#define SP(a) setprecision(a)
#define NP(a)(next_permutation(a.begin(), a.end()))
int gcd(int big, int small) {
if (big % small == 0) return small;
return gcd (small, big %small);
}
bool comp(pii a, pii b) {
return (a.S - a.F < b.S - b.F);
}
int main () {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//list<int>::iterator it;
int t, n, k;
pii now, ans;
cin >> t;
FO(u, 0, t) {
cin >> n >> k;
vi a(n);
FO(i, 0, n) {
cin >> a[i];
}
SS(a);
vi b(0);
FO(i, k - 1, n) {
if (a[i] == a[i - k + 1]) {
if (b.size() == 0 || b[b.size() - 1] != a[i]) b.PB(a[i]);
}
}
if (b.size() == 0) cout << -1 << N;
else {
ans = {b[0], 1};
now = ans;
FO(i, 1, b.size()) {
if (b[i] == b[i - 1] + 1) ++now.S;
else now = {b[i], 1};
if (now.S > ans.S) ans = now;
}
cout << ans.F << " " << ans.F + ans.S - 1 << N;
}
}
R(0);
}
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |
e-maze-in | Bricks Game |
Char Sum | Two Strings |
Anagrams | Prime Number |
Lexical Sorting Reloaded | 1514A - Perfectly Imperfect Array |
580A- Kefa and First Steps | 1472B- Fair Division |