n, m = map(int, input().split())
cnt = [0] * (m + 1)

for i in range(n):
    a = list(map(int, input().split()))
    for j in range(a[0]):
        cnt[a[j+1]] += 1

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

for i in range(n):
    a = list(map(int, input().split()))
    for j in range(a[0]):
        cnt[a[j+1]] += 1

ans = 0
for i in range(m+1):
    if cnt[i] == n:
        ans += 1

print(ans)
