#1074
Unrated
KOŠARE
시간 제한
2s
메모리 제한
256MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Gustav Matula

Mirko found N boxes with various forgotten toys at his attic. There are M different toys, numbered 1 through M, but each of those can appear multiple times across various boxes. Mirko decided that he will choose some boxes in a way that there is at least one toy of each kind present, and throw the rest of the boxes away. Determine the number of ways in which Mirko can do this.

입력

The first line of input contains two integers N and M (1 ≤ N ≤ 1 000 000, 1 ≤ M ≤ 20). Each of the following N lines contains an integer Ki (0 ≤ Ki ≤ M) followed by Ki distinct integers from interval [1, M], representing the toys in that box.

출력

The first and only line of output should contain the requested number of ways modulo 1 000 000 007.

예제 입력 1

3 3
3 1 2 3
3 1 2 3
3 1 2 3

예제 출력 1

7

예제 입력 2

3 3
1 1
1 2
1 3

예제 출력 2

1

예제 입력 3

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

예제 출력 3

6
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.