Club of Brutal People
Stepan is part of a renowned club known for its tough members. This club maintains a ranking of its members, which is updated only during their annual competitions.
The competition consists of m consecutive rounds. In each round, the top k participants (based on the current ranking) gather around a table with onions. As they begin cutting the onions, the first participant to shed a tear is moved to the last position in the ranking, and the round concludes. It's important to note that each participant has a unique ranking.
Throughout the competition, a record is kept, documenting the position of the eliminated participant after each round, which corresponds to their position at the start of that round (after the round, they are moved to the last position).
Stepan has found this year's competition record but has forgotten his initial position in the ranking before the competition began. However, he does remember his current position in the ranking. Your task is to help Stepan determine his position before the competition started.
Write a program to assist Stepan in figuring out his initial position before the competition began.
Input
The first line of input contains three integers n, k, m (1 ≤ k < n ≤ 10^9
, 1 ≤ m ≤ 10^5
) - representing the total number of club members, the number of participants in each round, and the number of rounds, respectively. The second line contains m integers: the i-th number a[i]
(1 ≤ a[i]
≤ k) indicates the position of the participant who was eliminated in the corresponding round. The third line contains a single integer p (1 ≤ p ≤ n) - Stepan's position after the competition.
Output
Output a single integer - Stepan's position before the competition started.
Examples
Note
Initially, Stepan was in the third position. After the first round, the participant in the first position was moved to the last, causing Stepan to move up to the second position. After the second round, Stepan was moved to the last position. Following the third round, he moved up to the fifth position.