Limits 1s, 512 MB

In a programming contest, a participant’s position is determined by 2 things. His score, ss, and his penalty, pp. The participant with the higher score will be ahead of the participant with a lower score. If scores are the same then, the participant with less penalty gets ahead of the other participant. No Two participants can have the same score and penalty at a time. Participants’ scores and penalties will be given in sorted order. You will be given a position, kk and you have to find out the minimum score and maximum penalty to get that exact position. Note that, the score can be up to 2500\textbf{2500} and penalty can be up to 180\textbf{180} and both score and penalty are non-negative integer numbers.

Input

The first line will contain two integer n(1n105)n(1 \le n \le 10^5) and kk (1kn)(1 \le k \le n) where nn is the number of participants and kk is the desired position.

In the next nn lines, you will be given two integers ss, pp (0s2500,0p180){(0 \le s \le 2500, 0 \le p \le 180)} where ss is the score and pp is the penalty.

Output

You have to Print two integer values - the minimum score (0score2500){(0 \le score \le 2500)} and maximum penalty (0penalty180){(0 \le penalty \le 180)} to get that exact position. If that exact position is not possible, print 1-1.

Samples

InputOutput
5 2
460 8
460 14
360 120
330 45
250 10
460 13
InputOutput
5 4
1370 77
1250 80
1140 6
1140 7
780 120
-1

Submit

Login to submit.

Contributors

Statistics

62% Solution Ratio
adnan_tokyEarliest, Jul '21
Nafis2003174.132453Fastest, 0.0s
Nafis2003174.132453Lightest, 5.5 kB
white_monsterShortest, 331B
Toph uses cookies. By continuing you agree to our Cookie Policy.