# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Find Score

By Tanzim_Ahad · Limits 1s, 512 MB

In a programming contest, a participant’s position is determined by 2 things. His score, $s$, and his penalty, $p$. 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, $k$ 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 $\textbf{2500}$ and penalty can be up to $\textbf{180}$ and both score and penalty are non-negative integer numbers.

## Input

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

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

## Output

You have to Print two integer values $-$ the minimum score ${(0 \le score \le 2500)}$ and maximum penalty ${(0 \le penalty \le 180)}$ to get that exact position. If that exact position is not possible, print $-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


• Implementation

### Statistics

59% Solution Ratio

sayeef006Fastest, 0.0s

Mizan18Lightest, 131 kB

YouKnowMEEMShortest, 489B

### Submit 