N, M = [int(i) for i in input().split()]

ans = set([i + 1 for i in range(M)])
for _ in range(N):
    T = input().split()
    A = set([int(i) for i in T[1:]])
    ans = ans & A
print(len(ans))
 int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i N, M = [int(i) for i in input().split()] N [int(i) for i in input().split()] M i + 1 for i in range(M) for i in range(M) i range(M) range M for i in range(M) i + 1 i 1 ans = set([i + 1 for i in range(M)]) ans set([i + 1 for i in range(M)]) set [i + 1 for i in range(M)] for _ in range(N):
    T = input().split()
    A = set([int(i) for i in T[1:]])
    ans = ans & A _ range(N) range N T = input().split() T input().split() ().split () input split int(i) for i in T[1:] for i in T[1:] i T[1:] T 1: 1 for i in T[1:] int(i) int i A = set([int(i) for i in T[1:]]) A set([int(i) for i in T[1:]]) set [int(i) for i in T[1:]] ans = ans & A ans ans & A ans A print(len(ans)) print len(ans) len ans T = input().split() input().split() T ans = ans & A ans & A ans ans = set([i + 1 for i in range(M)]) set([i + 1 for i in range(M)]) ans A = set([int(i) for i in T[1:]]) set([int(i) for i in T[1:]]) A M = [int(i) for i in input().split()] [int(i) for i in input().split()] M N, M = [int(i) for i in input().split()] [int(i) for i in input().split()] N
N, M = [int(i) for i in input().split()]

ans = set([i + 1 for i in range(M)])
for _ in range(N):
    T = input().split()
    A = set([int(i) for i in T[1:]])
    ans = ans & A
print(len(ans))

