n,m = map(int,input().split())
ans = [0]*m
for _ in range(n):
    T = list(map(int,input().split()))
    for i in range(1,len(T)):
        ans[T[i]-1] += 1


ans_s = 0
for a in ans:
    if a == n:
        ans_s += 1

print(ans_s) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m ans = [0]*m ans [0]*m [0] 0 m for _ in range(n):
    T = list(map(int,input().split()))
    for i in range(1,len(T)):
        ans[T[i]-1] += 1 _ range(n) range n T = list(map(int,input().split())) T list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(1,len(T)):
        ans[T[i]-1] += 1 i range(1,len(T)) range 1 len(T) len T ans[T[i]-1] += 1 ans[T[i]-1] ans T[i]-1 T[i] T i 1 1 ans_s = 0 ans_s 0 for a in ans:
    if a == n:
        ans_s += 1 a ans if a == n:
        ans_s += 1 a == n a n ans_s += 1 ans_s 1 print(ans_s) print ans_s n,m = map(int,input().split()) map(int,input().split()) n ans_s = 0 0 ans_s ans_s += 1 1 ans_s ans = [0]*m [0]*m ans m = map(int,input().split()) map(int,input().split()) m T = list(map(int,input().split())) list(map(int,input().split())) T
n,m = map(int,input().split())
ans = [0]*m
for _ in range(n):
    T = list(map(int,input().split()))
    for i in range(1,len(T)):
        ans[T[i]-1] += 1


ans_s = 0
for a in ans:
    if a == n:
        ans_s += 1

print(ans_s)