n,m = map(int,input().split())


menu =[0]*m 
for i in range(n):
    k,*a = map(int,input().split())
    for j in range(k):
        menu[a[j]-1] += 1

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


menu =[0]*m 
for i in range(n):
    k,*a = map(int,input().split())
    for j in range(k):
        menu[a[j]-1] += 1

print(menu.count(n))