Smallest Number Repeating K Times

easy
1. You will be given an array and its length 2. You will also get an integer k 3. You need to find the smallest element that repeats exactly k times 4. Input is handled for you 5. It is a functional problem ,please do not modify main()

Input Format

Input is handled for you.

Output Format

Print the smallest element that repeats exactly k times Print -1 if no such element found

Constraints

1<=N<=10000
 1<=K<=10

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
10
3
2 7 3 4 2 8 7 4 7 4
Output
4
Previous
Smallest Range In K List
Next
Single Number

Related Questions