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

ans = {}
for a in k_a:
    for i in a[1:]:
        if i in ans.keys():
            ans[i] += 1
        else:
            ans[i] = 1
print(sum([ 1 for i,v in ans.items() if v == n ])) 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 k_a = [ list(map(int, input().split())) for _ in range(n) ] k_a [ list(map(int, input().split())) for _ in range(n) ] ans = {} ans {} for a in k_a:
    for i in a[1:]:
        if i in ans.keys():
            ans[i] += 1
        else:
            ans[i] = 1 a k_a for i in a[1:]:
        if i in ans.keys():
            ans[i] += 1
        else:
            ans[i] = 1 i a[1:] a 1: 1 if i in ans.keys():
            ans[i] += 1
        else:
            ans[i] = 1 i in ans.keys() i ans.keys() ans.keys ans keys ans[i] += 1 ans[i] ans i 1 ans[i] = 1 ans[i] ans i 1 1 for i,v in ans.items() if v == n for i,v in ans.items() if v == n i v ans.items() ans.items ans items v == n v n if v == n 1 print(sum([ 1 for i,v in ans.items() if v == n ])) print sum([ 1 for i,v in ans.items() if v == n ]) sum [ 1 for i,v in ans.items() if v == n ] ans = {} {} ans m = map(int, input().split()) map(int, input().split()) m n, m = map(int, input().split()) map(int, input().split()) n k_a = [ list(map(int, input().split())) for _ in range(n) ] [ list(map(int, input().split())) for _ in range(n) ] k_a
n, m = map(int, input().split())
k_a = [ list(map(int, input().split())) for _ in range(n) ]

ans = {}
for a in k_a:
    for i in a[1:]:
        if i in ans.keys():
            ans[i] += 1
        else:
            ans[i] = 1
print(sum([ 1 for i,v in ans.items() if v == n ]))