Олимпиадный тренинг

Задача 38690. Circuit racing


Задача

Темы:
Participants in unicycle ring races are numbered from 1 to N. They have to drive K laps and the winner is the one who has completed them first. Participants start at the same time from a certain line, which is called the end of the circle. Each time a participant crosses this line, his number is recorded by the automatic system with high accuracy (that is, two participants cannot cross this line at the same time). After passing K laps, the same line is the finish line. Unfortunately, some participants drop out of the distance and complete fewer laps.
The organizers of the competition have forgotten the number K and are embarrassed to ask the participants for it. Help  organizers determine the winner of the competition using only the records from the fixing system. It is guaranteed that at least one of the participants completed the required K laps and none of the participants completed more than K laps. The first fixation of the participant number occurs after
passing the first lap.

Input data format
The first line contains integers N and M (1 ≤ N ≤ 100, 1 ≤ M ≤ 10000) — the number of contestants and records from the fixing system, respectively. The second line contains M integers from 1 to N – participant numbers in order
they were fixed by the system.

Output data format
Print one number — number of the winner
 
 
Examples
# Input Output
1 3 4
1 3 3 1
3
2 3 5
1 1 2 3 1
1