#abc235c. [abc235_c]The Kth Time Query
[abc235_c]The Kth Time Query
Problem Statement
We have a sequence of numbers: .
Process the queries explained below.
- Query : You are given a pair of integers . Let us look at the elements of one by one from the beginning: Which element will be the -th occurrence of the number ?
Print the index of that element, or if there is no such element.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer to Query .
Sample Input 1
6 8
1 1 2 3 1 2
1 1
1 2
1 3
1 4
2 1
2 2
2 3
4 1
Sample Output 1
1
2
5
-1
3
6
-1
-1
occurs in at . Thus, the answers to Query through are in this order.
Sample Input 2
3 2
0 1000000000 999999999
1000000000 1
123456789 1
Sample Output 2
2
-1