First Come First Serve

easy
1. You will be given an Array of customer ids in chronological order and its length. 2. You will also be given k, the ideal number of occurrences of customers' id. 3. You need to find the customer id that came first and occured exactly k times, if no such id is found, return -1. 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 id of the customer which will be served first

Constraints

1<=n<=1000
 1<=a[i]<=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
7 2
6 5 8 5 11 22 8
Output
5
Previous
Find Unique Element
Next
First Element To Occur K Times

Related Questions