Kth Distinct Element

easy
1. You will be given an Array with duplicate elements 2. You will also be given length of the array and an integral value k 3. You need to find kth element in the given array that is unique 4. Print -1, if no such element exists 5. Input is handled for you 6. It is a functional problem ,please do not modify main()

Input Format

Input is handled for you

Output Format

Print kth element in the given array that is unique Print -1, if no such element exists

Constraints

1<=N<=100000
 1<=K<=100

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
8
1 1 2 1 3 4 2 6
3
Output
6
Previous
Key Pair
Next
Largest Element In A Stream

Related Questions