N,M = map(int,input().split())
foods = [0]*(M+1)
for i in range(N):
  line = list(map(int,input().split()))
  for j in range(1,line[0]+1):
    foods[line[j]]+=1
print(foods.count(N)) N,M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M foods = [0]*(M+1) foods [0]*(M+1) [0] 0 M+1 M 1 for i in range(N):
  line = list(map(int,input().split()))
  for j in range(1,line[0]+1):
    foods[line[j]]+=1 i range(N) range N line = list(map(int,input().split())) line list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for j in range(1,line[0]+1):
    foods[line[j]]+=1 j range(1,line[0]+1) range 1 line[0]+1 line[0] line 0 1 foods[line[j]]+=1 foods[line[j]] foods line[j] line j 1 print(foods.count(N)) print foods.count(N) foods.count foods count N N,M = map(int,input().split()) map(int,input().split()) N M = map(int,input().split()) map(int,input().split()) M foods = [0]*(M+1) [0]*(M+1) foods line = list(map(int,input().split())) list(map(int,input().split())) line
N,M = map(int,input().split())
foods = [0]*(M+1)
for i in range(N):
  line = list(map(int,input().split()))
  for j in range(1,line[0]+1):
    foods[line[j]]+=1
print(foods.count(N))