n, m = map(int, input().split())
c = [0]*m

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

for i in range(n):
    a = list(map(int, input().split()))
    for j in range(1, a[0]+1):
        c[a[j]-1] += 1
print(c.count(n))