N,M=map(int,input().split())
foods=[N]*M
for i in range(N):
    A=list(map(int,input().split()))
    K=A.pop(0)
    for j in A: foods[j-1]-=1
print(foods.count(0)) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M foods=[N]*M foods [N]*M [N] N M for i in range(N):
    A=list(map(int,input().split()))
    K=A.pop(0)
    for j in A: foods[j-1]-=1 i range(N) range N A=list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split K=A.pop(0) K A.pop(0) A.pop A pop 0 for j in A: foods[j-1 j A print(foods.count(0)) print foods.count(0) foods.count foods count 0 foods=[N]*M [N]*M foods A=list(map(int,input().split())) list(map(int,input().split())) A K=A.pop(0) A.pop(0) K N,M=map(int,input().split()) map(int,input().split()) N M=map(int,input().split()) map(int,input().split()) M
N,M=map(int,input().split())
foods=[N]*M
for i in range(N):
    A=list(map(int,input().split()))
    K=A.pop(0)
    for j in A: foods[j-1]-=1
print(foods.count(0))