n,m=map(int, input().split())
table = [0]*m
c = 0
for i in range(n):
    ans = list(map(int, input().split()))
    for j in range(1,len(ans)):
        table[ans[j]-1] += 1
for i in range(m):
    if table[i] == n:
        c += 1
print(c)
 n,m=map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m table = [0]*m table [0]*m [0] 0 m c = 0 c 0 for i in range(n):
    ans = list(map(int, input().split()))
    for j in range(1,len(ans)):
        table[ans[j]-1] += 1 i range(n) range n ans = list(map(int, input().split())) ans list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for j in range(1,len(ans)):
        table[ans[j]-1] += 1 j range(1,len(ans)) range 1 len(ans) len ans table[ans[j]-1] += 1 table[ans[j]-1] table ans[j]-1 ans[j] ans j 1 1 for i in range(m):
    if table[i] == n:
        c += 1 i range(m) range m if table[i] == n:
        c += 1 table[i] == n table[i] table i n c += 1 c 1 print(c) print c table = [0]*m [0]*m table c = 0 0 c ans = list(map(int, input().split())) list(map(int, input().split())) ans c += 1 1 c m=map(int, input().split()) map(int, input().split()) m n,m=map(int, input().split()) map(int, input().split()) n
n,m=map(int, input().split())
table = [0]*m
c = 0
for i in range(n):
    ans = list(map(int, input().split()))
    for j in range(1,len(ans)):
        table[ans[j]-1] += 1
for i in range(m):
    if table[i] == n:
        c += 1
print(c)

