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