n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]

d = {}
for i in range(m):
    d[i+1] = 0

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

d = {}
for i in range(m):
    d[i+1] = 0

for i in a:
    for j in i[1:]:
        d[j] += 1
ans = 0
for i in d.values():
    if i == n:
        ans += 1
print(ans)