Guest User

Untitled

a guest
Jul 18th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. Serbian competitors know Secret Committee very well. Its members like programming,but they like eating sarmas, aswell. There are N members of the Committee, and each of them brings a box containing his favourite meal.
  2.  
  3. In the pass time they play a very interesting game. All boxes are laid in a row. Player opens a box (which represents 1 move), counts sarmas in there and opens the box whose index corresponds to the number of sarmas counted. This repeats 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.
  4.  
  5. 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 the yesterday's game and has eaten 88 sarmas,so he cannot calculate which box to start with. Help Alexander not to lose any weight.
  6.  
  7. INPUT:
  8.  
  9. First line of standard input contains 2 integers - N and K. (1<=k<=n<=1 000 000)
  10. Next N lines contains sarma quantities. I-th line represents how many sarmas is there in the Ith boxi.
  11.  
  12. OUTPUT:
  13. Output contains one line - index of box(indexes start at 1) which Alexander should open first.If there are multiple solutions print the smallest.
  14.  
  15. Input:
Add Comment
Please, Sign In to add comment