#00006A

z-bilijar

Friends of little Z-a, Mister R and Mister S, are decide to go with their girlfriends, Cmoka and Zita, to snooker. Previous evening they bought N chips. Not all type of chips are allowed in all snooker clubs, to prevent customers buy in one club and play in another. Since Mister R and Mister S don't like to spend all time in same club, they bought several type of chips. Some of them can use in some of snooker clubs. They don't want their girlfriends to feel bored so plan is to change club after every game and not come back in this club again. They ask little Z-a to help them to visit as much clubs as possible.



InputIn first line of input are numbers N (1 <= N <= 1000) and M (1 <= M <= 1000), number of chips and number of clubs.
From second line to N+1st line: in i+1st line is integer k, and then in same line k (0 <= k <= M) integers representing clubs in which is allowed to use chip i.


OutputOn standard input, print maximum number of clubs they can visit and play one game in it.


Example: 1

Input:
3 3
3 1 2 3
2 1 2
1 1

Output:
3



Example: 2

Input:
3 3
1 1
2 1 2
2 1 2

Output:
2

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.