N,M=map(int,input().split())
A=list(map(int,input().split()))
A.pop(0)

if N>1:
    for _ in range(N-1):
        B=list(map(int,input().split()))
        B.pop(0)
        A=[num for num in A if num in B]

print(len(A)) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M A=list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split A.pop(0) A.pop A pop 0 if N>1:
    for _ in range(N-1):
        B=list(map(int,input().split()))
        B.pop(0)
        A=[num for num in A if num in B] N>1 N 1 for _ in range(N-1):
        B=list(map(int,input().split()))
        B.pop(0)
        A=[num for num in A if num in B] _ range(N-1) range N-1 N 1 B=list(map(int,input().split())) B list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split B.pop(0) B.pop B pop 0 num for num in A if num in B for num in A if num in B num A num in B num B if num in B num A=[num for num in A if num in B] A [num for num in A if num in B] print(len(A)) print len(A) len A M=map(int,input().split()) map(int,input().split()) M A=list(map(int,input().split())) list(map(int,input().split())) A N,M=map(int,input().split()) map(int,input().split()) N B=list(map(int,input().split())) list(map(int,input().split())) B A=[num for num in A if num in B] [num for num in A if num in B] A
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.pop(0)

if N>1:
    for _ in range(N-1):
        B=list(map(int,input().split()))
        B.pop(0)
        A=[num for num in A if num in B]

print(len(A))