In IOI Park,
JOI-kun will attend exactly
JOI-kun wants to attend events with small indices. More precisely, let
Write a program which, given the information of the events and the number
Input Specification
Read the following data from the standard input. Given values are all integers.
Output Specification
If JOI-kun will not be able to attend -1
to the standard output.
If JOI-kun will be able to attend
Constraints
. . .
Subtasks
- (7 points)
. - (1 point)
. - (31 points)
. - (61 points) No additional constraints.
Sample Input 1
5 4
1 3
2 5
8 9
6 8
10 15
Sample Output 1
1
3
4
5
Explanation for Sample 1
There are 2 ways for JOI-kun to attend exactly 4 events.
- JOI-kun will attend the events
. - JOI-kun will attend the events
.
Since the sequence
Sample Input 2
4 3
1 4
3 5
4 9
7 10
Sample Output 2
-1
Explanation for Sample 2
Since it is impossible for JOI-kun to attend exactly -1
.
Sample Input 3
10 6
77412002 93858605
244306432 318243514
280338037 358494212
439397354 492065507
485779890 529132783
571714810 632053254
659767854 709114867
718405631 733610573
786950301 815106357
878719468 899999649
Sample Output 3
1
2
4
6
7
8
Explanation for Sample 3
This sample input satisfies the constraints of all Subtasks.
Sample Input 4
20 16
250732298 258217736
26470443 34965880
252620676 260043105
692063405 697656580
497457675 504191511
391372149 397942668
858168758 867389085
235756850 241022021
585764751 593366541
207824318 217052204
661682908 671226688
886273261 892279963
770109416 778960597
264372562 270395107
176883483 186662376
509929119 519063796
109491630 118520141
162731982 168101507
662727316 668317158
757072772 765493222
Sample Output 4
1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Comments