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