N, M = map(int, input().split())

l = []

for i in range(N):
    A = [int(x) for x in input().split()]

    for j in range(1, A[0] + 1):
        l.append(A[j])

ans = 0

for i in range(M + 1):
    if l.count(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 l = [] l [] for i in range(N):
    A = [int(x) for x in input().split()]

    for j in range(1, A[0] + 1):
        l.append(A[j]) i range(N) range N int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A = [int(x) for x in input().split()] A [int(x) for x in input().split()] for j in range(1, A[0] + 1):
        l.append(A[j]) j range(1, A[0] + 1) range 1 A[0] + 1 A[0] A 0 1 l.append(A[j]) l.append l append A[j] A j ans = 0 ans 0 for i in range(M + 1):
    if l.count(i) == N:
        ans += 1 i range(M + 1) range M + 1 M 1 if l.count(i) == N:
        ans += 1 l.count(i) == N l.count(i) l.count l count i N ans += 1 ans 1 print(ans) print ans ans += 1 1 ans l = [] [] l A = [int(x) for x in input().split()] [int(x) for x in input().split()] A M = map(int, input().split()) map(int, input().split()) M N, M = map(int, input().split()) map(int, input().split()) N ans = 0 0 ans
N, M = map(int, input().split())

l = []

for i in range(N):
    A = [int(x) for x in input().split()]

    for j in range(1, A[0] + 1):
        l.append(A[j])

ans = 0

for i in range(M + 1):
    if l.count(i) == N:
        ans += 1

print(ans)