Sarme
Serbian competitors know the Secret Committee very well. Its members like programming, but they like eating sarmas, as well. There are N members of the Committee, and each of them bring a box containing their favourite meal.
In the passtime they play a very interesting game. All boxes are laid in a row. Player opens a box (which represents 1 move), counts the sarmas in there and opens the box whose index corresponds to the number of sarmas counted. This is repeated K times. The winner is the person who saw the most sarmas(if a player saw the same sarma more times than once, it counts as one) and he gets all the sarmas.
The Committee asked little Alexander to participate in this game in honor of his good competition results. Alexander is,however,a known troll, and he secretly counted how many sarmas there are in each box.He also noticed that the numbers of sarmas in the boxes represent a permutation of numbers [1,N]. Alas,he has won yesterday's game and has eaten 88 sarmas,so he cannot calculate which box to start with. Help Alexander not to lose any weight.
First line of standard input contains 2 integers - N and K. (1<=k<=n<=1 000 000)
Next N lines contains sarma quantities. I-th line represents how many sarmas is there in the Ith boxi.
10 8
2
3
5
8
7
10
9
1
6
4Output:
2Input:
4 3
1
4
3
2
Output:
2
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.