n,m=map(int,input().split())
li=[list(map(int, input().split()))[1:] for _ in range(n)]
res=[0]*m
for i in range(n):
    for j in range(len(li[i])):
        res[li[i][j]-1]+=1
print(res.count(n)) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m list(map(int, input().split()))[1:] for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split()))[1:] (map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 1: 1 li=[list(map(int, input().split()))[1:] for _ in range(n)] li [list(map(int, input().split()))[1:] for _ in range(n)] res=[0]*m res [0]*m [0] 0 m for i in range(n):
    for j in range(len(li[i])):
        res[li[i][j]-1]+=1 i range(n) range n for j in range(len(li[i])):
        res[li[i][j]-1]+=1 j range(len(li[i])) range len(li[i]) len li[i] li i res[li[i][j]-1]+=1 res[li[i][j]-1] res li[i][j]-1 li[i][j] [i] li i j 1 1 print(res.count(n)) print res.count(n) res.count res count n n,m=map(int,input().split()) map(int,input().split()) n li=[list(map(int, input().split()))[1:] for _ in range(n)] [list(map(int, input().split()))[1:] for _ in range(n)] li m=map(int,input().split()) map(int,input().split()) m res=[0]*m [0]*m res
n,m=map(int,input().split())
li=[list(map(int, input().split()))[1:] for _ in range(n)]
res=[0]*m
for i in range(n):
    for j in range(len(li[i])):
        res[li[i][j]-1]+=1
print(res.count(n))