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

for i in range(n):
  k = list(map(int,input().split()))
  for j in range(1,k[0]+1):
    array[k[j]-1] += 1

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

for i in range(n):
  k = list(map(int,input().split()))
  for j in range(1,k[0]+1):
    array[k[j]-1] += 1

print(array.count(n))
