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

lst = [0]*M

for i in range(N):
    for j in range(KA[i][0]):
        lst[KA[i][j+1]-1] += 1

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

lst = [0]*M

for i in range(N):
    for j in range(KA[i][0]):
        lst[KA[i][j+1]-1] += 1

ans = lst.count(N)
print(ans)
