Moovie Mooving
Bessie is out at the movies. Being mischievous as always, she has decided to hide from Farmer John for l minutes, during which time she wants to watch movies continuously. She has n movies to choose from, each of which has a certain duration and a set of showtimes during the day. Bessie may enter and exit a movie at any time during one if its showtimes, but she does not want to ever visit the same movie twice, and she cannot switch to another showtime of the same movie that overlaps the current showtime.
Help Bessie by determining if it is possible for her to achieve her goal of watching movies continuously from time 0 through time l. If it is, determine the minimum number of movies she needs to see toachieve this goal (Bessie gets confused with plot lines if she watches too many movies).
Input
The first line contains n (1 ≤ n ≤ 20) and l (1 ≤ l ≤ 10^8
).
The next n lines each describe a movie. They begin with its integer duration d (1 ≤ d ≤ l) and the number of showtimes c (1 ≤ c ≤ 1000). The remaining c integers on the same line are each in the range 0..l, and give the starting time of one of the showings of themovie. Showtimes are distinct, in the range 0..l, and given in increasing order.
Output
Print a single integer indicating the minimum number of movies that Bessie needs to see to achieve her goal. If this is impossible output -1 instead.
Example
Bessie should attend the first showing of the fourth movie from time 0 to time 20. Then she watches the first showing of the first movie from time 20 to time 65. Finally she watches the last showing of the second movie from time 65 to time 100.