N, M = map(int, input().split())
ans = [0 for _ in range(M)]
for i in range(N):
    a = list(map(int, input().split()))
    for i in a[1:]:
        ans[i-1] += 1
print(ans.count(N)) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M 0 for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) 0 ans = [0 for _ in range(M)] ans [0 for _ in range(M)] for i in range(N):
    a = list(map(int, input().split()))
    for i in a[1:]:
        ans[i-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 i in a[1:]:
        ans[i-1] += 1 i a[1:] a 1: 1 ans[i-1] += 1 ans[i-1] ans i-1 i 1 1 print(ans.count(N)) print ans.count(N) ans.count ans count N M = map(int, input().split()) map(int, input().split()) M N, M = map(int, input().split()) map(int, input().split()) N ans = [0 for _ in range(M)] [0 for _ in range(M)] ans a = list(map(int, input().split())) list(map(int, input().split())) a
N, M = map(int, input().split())
ans = [0 for _ in range(M)]
for i in range(N):
    a = list(map(int, input().split()))
    for i in a[1:]:
        ans[i-1] += 1
print(ans.count(N))
