n, m = map(int, input().split())
suki = [0]*(m+1)

for i in range(n):
    ka = list(map(int, input().split()))
    for j in range(1, ka[0]+1):
        suki[ka[j]] += 1

ans = 0
for i in range(1, m+1):
    if suki[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 suki = [0]*(m+1) suki [0]*(m+1) [0] 0 m+1 m 1 for i in range(n):
    ka = list(map(int, input().split()))
    for j in range(1, ka[0]+1):
        suki[ka[j]] += 1 i range(n) range n ka = list(map(int, input().split())) ka list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for j in range(1, ka[0]+1):
        suki[ka[j]] += 1 j range(1, ka[0]+1) range 1 ka[0]+1 ka[0] ka 0 1 suki[ka[j]] += 1 suki[ka[j]] suki ka[j] ka j 1 ans = 0 ans 0 for i in range(1, m+1):
    if suki[i] == n:
        ans += 1 i range(1, m+1) range 1 m+1 m 1 if suki[i] == n:
        ans += 1 suki[i] == n suki[i] suki i n ans += 1 ans 1 print(ans) print ans ka = list(map(int, input().split())) list(map(int, input().split())) ka m = map(int, input().split()) map(int, input().split()) m ans = 0 0 ans suki = [0]*(m+1) [0]*(m+1) suki ans += 1 1 ans n, m = map(int, input().split()) map(int, input().split()) n
n, m = map(int, input().split())
suki = [0]*(m+1)

for i in range(n):
    ka = list(map(int, input().split()))
    for j in range(1, ka[0]+1):
        suki[ka[j]] += 1

ans = 0
for i in range(1, m+1):
    if suki[i] == n:
        ans += 1
print(ans)
