N, M = map(int,input().split())
dish = [0 for i in range(M)]
for i in range(N):
  like = list(map(int,input().split()))
  for i in like[1:]:
    dish[i-1]+=1
ans = dish.count(N)
print(ans) N, M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M 0 for i in range(M) for i in range(M) i range(M) range M for i in range(M) 0 dish = [0 for i in range(M)] dish [0 for i in range(M)] for i in range(N):
  like = list(map(int,input().split()))
  for i in like[1:]:
    dish[i-1]+=1 i range(N) range N like = list(map(int,input().split())) like list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in like[1:]:
    dish[i-1]+=1 i like[1:] like 1: 1 dish[i-1]+=1 dish[i-1] dish i-1 i 1 1 ans = dish.count(N) ans dish.count(N) dish.count dish count N print(ans) print ans M = map(int,input().split()) map(int,input().split()) M ans = dish.count(N) dish.count(N) ans N, M = map(int,input().split()) map(int,input().split()) N like = list(map(int,input().split())) list(map(int,input().split())) like dish = [0 for i in range(M)] [0 for i in range(M)] dish
N, M = map(int,input().split())
dish = [0 for i in range(M)]
for i in range(N):
  like = list(map(int,input().split()))
  for i in like[1:]:
    dish[i-1]+=1
ans = dish.count(N)
print(ans)