N,M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

fond = [0]*(M+1)

for i in A:
    for j in i[1:]:
        fond[j] += 1
        
print(fond.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())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split A = [list(map(int, input().split())) for _ in range(N)] A [list(map(int, input().split())) for _ in range(N)] fond = [0]*(M+1) fond [0]*(M+1) [0] 0 M+1 M 1 for i in A:
    for j in i[1:]:
        fond[j] += 1
         i A for j in i[1:]:
        fond[j] += 1
         j i[1:] i 1: 1 fond[j] += 1 fond[j] fond j 1 print(fond.count(N)) print fond.count(N) fond.count fond count N A = [list(map(int, input().split())) for _ in range(N)] [list(map(int, input().split())) for _ in range(N)] A M = map(int, input().split()) map(int, input().split()) M N,M = map(int, input().split()) map(int, input().split()) N fond = [0]*(M+1) [0]*(M+1) fond
N,M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

fond = [0]*(M+1)

for i in A:
    for j in i[1:]:
        fond[j] += 1
        
print(fond.count(N))