N, M = map(int, input().split())
d = [0]*M
for _ in range(N):
    K, *A = map(int, input().split())
    for a in A:
        d[a-1] += 1
print(d.count(N)) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M d = [0]*M d [0]*M [0] 0 M for _ in range(N):
    K, *A = map(int, input().split())
    for a in A:
        d[a-1] += 1 _ range(N) range N K, *A = map(int, input().split()) K map(int, input().split()) map int input().split() ().split () input split *A A for a in A:
        d[a-1] += 1 a A d[a-1] += 1 d[a-1] d a-1 a 1 1 print(d.count(N)) print d.count(N) d.count d count N K, *A = map(int, input().split()) map(int, input().split()) K d = [0]*M [0]*M d N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M
N, M = map(int, input().split())
d = [0]*M
for _ in range(N):
    K, *A = map(int, input().split())
    for a in A:
        d[a-1] += 1
print(d.count(N))