n,m=map(int,input().split())
mylist=[n]*m
for i in range(n):
    ans=list(map(int,input().split()))
    for j in range(1,ans[0]+1):
        mylist[ans[j]-1]-=1
print(mylist.count(0)) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m mylist=[n]*m mylist [n]*m [n] n m for i in range(n):
    ans=list(map(int,input().split()))
    for j in range(1,ans[0]+1):
        mylist[ans[j]-1]-=1 i range(n) range n ans=list(map(int,input().split())) ans list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for j in range(1,ans[0]+1):
        mylist[ans[j]-1]-=1 j range(1,ans[0]+1) range 1 ans[0]+1 ans[0] ans 0 1 mylist[ans[j]-1]-=1 mylist[ans[j]-1] mylist ans[j]-1 ans[j] ans j 1 1 print(mylist.count(0)) print mylist.count(0) mylist.count mylist count 0 mylist=[n]*m [n]*m mylist ans=list(map(int,input().split())) list(map(int,input().split())) ans 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())
mylist=[n]*m
for i in range(n):
    ans=list(map(int,input().split()))
    for j in range(1,ans[0]+1):
        mylist[ans[j]-1]-=1
print(mylist.count(0))