N, M = map(int, input().split())
cnt = [0] * M

for i in range(N):
    line = list(map(int, input().split()))[1:]
    for j in line:
        cnt[j-1] += 1

ans = sum([1 if i == N else 0 for i in cnt])
print(ans) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M cnt = [0] * M cnt [0] * M [0] 0 M for i in range(N):
    line = list(map(int, input().split()))[1:]
    for j in line:
        cnt[j-1] += 1 i range(N) range N line = list(map(int, input().split()))[1:] line list(map(int, input().split()))[1:] (map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 1: 1 for j in line:
        cnt[j-1] += 1 j line cnt[j-1] += 1 cnt[j-1] cnt j-1 j 1 1 1 if i == N else 0 for i in cnt for i in cnt i cnt for i in cnt 1 if i == N else 0 i == N i N 1 0 ans = sum([1 if i == N else 0 for i in cnt]) ans sum([1 if i == N else 0 for i in cnt]) sum [1 if i == N else 0 for i in cnt] print(ans) print ans N, M = map(int, input().split()) map(int, input().split()) N line = list(map(int, input().split()))[1:] list(map(int, input().split()))[1:] line ans = sum([1 if i == N else 0 for i in cnt]) sum([1 if i == N else 0 for i in cnt]) ans M = map(int, input().split()) map(int, input().split()) M cnt = [0] * M [0] * M cnt
N, M = map(int, input().split())
cnt = [0] * M

for i in range(N):
    line = list(map(int, input().split()))[1:]
    for j in line:
        cnt[j-1] += 1

ans = sum([1 if i == N else 0 for i in cnt])
print(ans)
