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