N,M = map(int,input().split())
C = [0] * (M+1)
for i in range(N):
    K = list(map(int, input().split()))
    for k in range(len(K)):
        if k != 0:
            C[K[k]] += 1
count = 0

for c in C:
    if c == N:
        count += 1

print(count) N,M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M C = [0] * (M+1) C [0] * (M+1) [0] 0 M+1 M 1 for i in range(N):
    K = list(map(int, input().split()))
    for k in range(len(K)):
        if k != 0:
            C[K[k]] += 1 i range(N) range N K = list(map(int, input().split())) K list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for k in range(len(K)):
        if k != 0:
            C[K[k]] += 1 k range(len(K)) range len(K) len K if k != 0:
            C[K[k]] += 1 k != 0 k 0 C[K[k]] += 1 C[K[k]] C K[k] K k 1 count = 0 count 0 for c in C:
    if c == N:
        count += 1 c C if c == N:
        count += 1 c == N c N count += 1 count 1 print(count) print count count = 0 0 count N,M = map(int,input().split()) map(int,input().split()) N K = list(map(int, input().split())) list(map(int, input().split())) K M = map(int,input().split()) map(int,input().split()) M count += 1 1 count C = [0] * (M+1) [0] * (M+1) C
N,M = map(int,input().split())
C = [0] * (M+1)
for i in range(N):
    K = list(map(int, input().split()))
    for k in range(len(K)):
        if k != 0:
            C[K[k]] += 1
count = 0

for c in C:
    if c == N:
        count += 1

print(count)