The club is holding a coding contest for Sujin's birthday.
N coders numbered 1 through N enter the contest, and coder i has a skill value Di. N is odd.
The contest is played in teams of two, so the N + 1 people, Sujin included, split into pairs. The organizers keep the teams balanced by forming them this way.
The coders numbered M or below already have a fixed starting position in the row. Sujin can place the remaining N - M coders in the empty positions in any order she likes, and she wants to team up with a coder whose skill is as high as possible. Write a program that computes the largest skill a coder teamed up with Sujin can have.
The first line contains the number of coders N and the number of coders whose starting position is fixed, M.
Each of the next M lines contains the coding skill Di and the starting position Pi of coder i (1≤i≤M).
Each of the next N - M lines contains the coding skill Di of coder i (M+1≤i≤N), one per line.
Print on the first line the largest coding skill a coder teamed up with Sujin can have.