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

for _ in range(N):
    items = list(map(int,input().split()))
    for i in range(1,len(items)):
        like[items[i]-1] += 1

ans = 0
for i in range(M):
    if like[i] == N:
        ans += 1

print(ans) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M like = [0]*M like [0]*M [0] 0 M for _ in range(N):
    items = list(map(int,input().split()))
    for i in range(1,len(items)):
        like[items[i]-1] += 1 _ range(N) range N items = list(map(int,input().split())) items list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(1,len(items)):
        like[items[i]-1] += 1 i range(1,len(items)) range 1 len(items) len items like[items[i]-1] += 1 like[items[i]-1] like items[i]-1 items[i] items i 1 1 ans = 0 ans 0 for i in range(M):
    if like[i] == N:
        ans += 1 i range(M) range M if like[i] == N:
        ans += 1 like[i] == N like[i] like i N ans += 1 ans 1 print(ans) print ans M=map(int,input().split()) map(int,input().split()) M N,M=map(int,input().split()) map(int,input().split()) N like = [0]*M [0]*M like items = list(map(int,input().split())) list(map(int,input().split())) items ans = 0 0 ans ans += 1 1 ans
N,M=map(int,input().split())
like = [0]*M

for _ in range(N):
    items = list(map(int,input().split()))
    for i in range(1,len(items)):
        like[items[i]-1] += 1

ans = 0
for i in range(M):
    if like[i] == N:
        ans += 1

print(ans)