n,m = map(int,input().split())
x = [0]*(m+1)
for i in range(n):
    d = list(map(int,input().split()))
    for i in d[1:]:
        x[i] += 1
print(x.count(n)) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m x = [0]*(m+1) x [0]*(m+1) [0] 0 m+1 m 1 for i in range(n):
    d = list(map(int,input().split()))
    for i in d[1:]:
        x[i] += 1 i range(n) range n d = list(map(int,input().split())) d list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in d[1:]:
        x[i] += 1 i d[1:] d 1: 1 x[i] += 1 x[i] x i 1 print(x.count(n)) print x.count(n) x.count x count n n,m = map(int,input().split()) map(int,input().split()) n m = map(int,input().split()) map(int,input().split()) m d = list(map(int,input().split())) list(map(int,input().split())) d x = [0]*(m+1) [0]*(m+1) x
n,m = map(int,input().split())
x = [0]*(m+1)
for i in range(n):
    d = list(map(int,input().split()))
    for i in d[1:]:
        x[i] += 1
print(x.count(n))
