N, M = map(int, input().split())

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

ans = 0

for i in range(1, M + 1):
    for K in A:
        if K.count(i) == 0:
            break
    else:
        ans += 1

print(ans) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M list(map(int, input().split()))[1:] for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, input().split()))[1:] (map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 1: 1 A = [list(map(int, input().split()))[1:] for _ in range(N)] A [list(map(int, input().split()))[1:] for _ in range(N)] ans = 0 ans 0 for i in range(1, M + 1):
    for K in A:
        if K.count(i) == 0:
            break
    else:
        ans += 1 i range(1, M + 1) range 1 M + 1 M 1 for K in A:
        if K.count(i) == 0:
            break
    else:
        ans += 1 K A if K.count(i) == 0:
            break
     K.count(i) == 0 K.count(i) K.count K count i 0 break ans += 1 ans 1 print(ans) print ans A = [list(map(int, input().split()))[1:] for _ in range(N)] [list(map(int, input().split()))[1:] for _ in range(N)] A ans = 0 0 ans N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M ans += 1 1 ans
N, M = map(int, input().split())

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

ans = 0

for i in range(1, M + 1):
    for K in A:
        if K.count(i) == 0:
            break
    else:
        ans += 1

print(ans)