#Lutece1144. Big Brother

Big Brother

Migrated from Lutece 1144 Big Brother

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

现在有nn个囚笼,需要关押mm个犯人,the big brother很担心囚笼的安全性,因为犯人都有自己的想法,他们只想住在特定的囚笼里面,那么big brother想知道最多 能关押多少个犯人,每个囚笼只能关押一个犯人,一个犯人也只能关押在一个囚笼里面。

Input

第一行 两个整数,N(0N200)N (0 \leq N \leq 200)M(0M200)M (0 \leq M \leq 200)NN 是犯人的数量,MM 是囚笼的数量。

第二行到第N+1N+1行 一共 NN 行,每行对应一只犯人。第一个数字 (Si)(Si) 是这哥犯人愿意待的囚笼的数量 (0SiM)(0 \leq Si \leq M)。后面的SiSi个数表示这些囚笼的编号。

囚笼的编号限定在区间 (1..M)(1..M) 中,在同一行,一个囚笼不会被列出两次。

Output

只有一行。输出一个整数,表示最多能分配到的囚笼的数量.

Samples

5 5
1 1
1 2
1 3
1 4
1 5
5

Resources

2015 UESTC Training for Graph Theory