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

l = []
for i in range(N):
    for j in ka[i][1:]:
        l.append(j)

ans = 0
for i in range(M):
    if l.count(i+1) == N:
        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())) for i in range(N) for i in range(N) i range(N) range N for i in range(N) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ka = [list(map(int, input().split())) for i in range(N)] ka [list(map(int, input().split())) for i in range(N)] l = [] l [] for i in range(N):
    for j in ka[i][1:]:
        l.append(j) i range(N) range N for j in ka[i][1:]:
        l.append(j) j ka[i][1:] [i] ka i 1: 1 l.append(j) l.append l append j ans = 0 ans 0 for i in range(M):
    if l.count(i+1) == N:
        ans += 1 i range(M) range M if l.count(i+1) == N:
        ans += 1 l.count(i+1) == N l.count(i+1) l.count l count i+1 i 1 N ans += 1 ans 1 print(ans) print ans M = map(int, input().split()) map(int, input().split()) M l = [] [] l N, M = map(int, input().split()) map(int, input().split()) N ans += 1 1 ans ans = 0 0 ans ka = [list(map(int, input().split())) for i in range(N)] [list(map(int, input().split())) for i in range(N)] ka
N, M = map(int, input().split())
ka = [list(map(int, input().split())) for i in range(N)]

l = []
for i in range(N):
    for j in ka[i][1:]:
        l.append(j)

ans = 0
for i in range(M):
    if l.count(i+1) == N:
        ans += 1

print(ans)
