제출: 26 통과: 15

[제출] [채점기록] [묻고답하기]

The cows are having their first election after overthrowing the tyrannical Farmer John, and Bessie is one of *N* cows (1 ≤ *N* ≤ 50,000) running for President. Before the election actually happens, however, Bessie wants to determine who has the best chance of winning.

The election consists of two rounds. In the first round, the *K* cows (1 ≤ *K* ≤ *N*) cows with the most votes advance to the second round. In the second round, the cow with the most votes becomes President.

Given that cow *i* expects to get *A _{i}* votes (1 ≤

* Line 1: Two space-separated integers: *N* and *K*

* Lines 2..*N*+1: Line i+1 contains two space-separated integers: *A _{i}* and

* Line 1: The index of the cow that is expected to win the election.

```
5 3
3 10
9 2
5 6
8 4
6 5
```

```
5
```