405999: GYM102215 E Third-Party Software - 2

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Third-Party Software - 2time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Pavel is developing another game. To do that, he again needs functions available in a third-party library too famous to be called. There are $$$m$$$ functions numbered from $$$1$$$ to $$$m$$$, and it is known that the $$$i$$$-th version of the library contains functions from $$$a_i$$$ to $$$b_i$$$ inclusively.

The library is not free and Pavel needs all the functions. What minimal number of versions does he need to purchase to be able to use all the functions?

Input

The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 200000, 1 \le m \le 10^{9}$$$) — the number of library versions and the number of functions.

Each of the next $$$n$$$ lines contains two integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \le a_i \le b_i \le m$$$) — the interval of function numbers available in the $$$i$$$-th version.

Output

In the first line output «YES» or «NO», depending on if it's possible or not to purchase library versions to use all the functions.

In case of the positive answer output two more lines. In the second line output a single integer $$$k$$$ — the minimal number of library versions needed to be purchased. In the third line output $$$k$$$ distinct integers — the numbers of versions needed to be purchased.

If there are several possible answers, output any of them.

ExamplesInput
4 8
1 2
3 4
5 6
7 8
Output
YES
4
1 2 3 4 
Input
4 8
1 5
2 7
3 4
6 8
Output
YES
2
1 4 
Input
3 8
1 3
4 5
6 7
Output
NO

加入题单

上一题 下一题 算法标签: