Limits 1s, 512 MB

Have you seen the monkey sticker set? Maybe not.But I am pretty sure you have seen it a lot if you ever chatted with our Sir. But what is the deal between the sticker set and the problem? The problem is very simple. Sir wants to chat with K( ≤ 300000) different fans, and you are the General of his army. So, you already know the given monkey sticker sequence of length n( ≤ 300000). In the monkey sequence, same sticker may appear more than once. But all the stickers that will be sent to K different fans must be distinct ( i.e. no two fans will receive same sticker). You need to find a consecutive segment from the sequence so that it contains at least K distinct stickers and the segment must be as small as possible.

Formally,you are given an integer sequence A1, A2, ..., An of size n( n ≤ 300000) which represents the given sticker sequence. Ai denotes the type of i-th sticker.Each Ai is positive and does not exceed n (i.e. 1≤ A i ≤ n for 1≤ i≤ n).If i-th and j-th stickers are same, Ai =Aj, otherwise they will be different.

You have to find the smallest segment Al, Al+1, ..., Ar-1, Ar which contains at least k distinct elements.

If there are multiple such segments with minimum size, find the segment with minimum l.
If there is not any such segment,put -1.

Input

First line of the input contains number of test cases, T (1≤T≤100000). For each test case, there will be a single line with n (1≤n≤300000) and k (1≤k≤300000). Next line contains n integers which denotes the sequence. Each element in the array is positive and less than or equals n.

It is guaranteed that sum of n over all test cases does not exceed 300000.

Output

For each test cases, there will be a single line of output.If no segment exist which contains k distinct number, output -1. Otherwise, print l and r ( 1≤l≤r≤n) which means segment Al, Al+1, ..., Ar-1, Ar is the smallest segment with k distinct elements.
Note that, if there are multiple such segments with minimum size, segment with smallest l should be chosen.

Sample

InputOutput
2
10 4
1 2 1 2 4 4 3 4 2 1
10 4
1 2 1 2 4 4 3 3 2 1
7 10
3 7

For the 1st test case of the sample, A7, ..., A10 is the smallest possible segment with size 4.
For the 2nd test case, both A3, ... ,A7 and A6, ... ,A10 are segments with smallest possible size but first segment is chosen.

Submit

Login to submit.

Statistics

88% Solution Ratio
Revenant27Earliest, Feb '20
Kuddus.6068Fastest, 0.0s
ndc11805075Lightest, 655 kB
Rashid.657145Shortest, 1009B
Toph uses cookies. By continuing you agree to our Cookie Policy.