N, M = list(map(lambda a: int(a), input().split(" ")))
P = [(i + 1) for i in range(M)]
s = []
for j in range(N):
  A = list(map(lambda x: int(x), input().split(" ")))
  s.append(A[1:])
  
for k in range(len(s)):
  P = list(set(P) & set(s[k]))


print(len(P)) N, M = list(map(lambda a: int(a), input().split(" "))) N list(map(lambda a: int(a), input().split(" "))) list map(lambda a: int(a), input().split(" ")) map lambda a: int(a) int(a) int a a input().split(" ") ().split () input split " " M (i + 1) for i in range(M) for i in range(M) i range(M) range M for i in range(M) i + 1 i 1 P = [(i + 1) for i in range(M)] P [(i + 1) for i in range(M)] s = [] s [] for j in range(N):
  A = list(map(lambda x: int(x), input().split(" ")))
  s.append(A[1:])
   j range(N) range N A = list(map(lambda x: int(x), input().split(" "))) A list(map(lambda x: int(x), input().split(" "))) list map(lambda x: int(x), input().split(" ")) map lambda x: int(x) int(x) int x x input().split(" ") ().split () input split " " s.append(A[1:]) s.append s append A[1:] A 1: 1 for k in range(len(s)):
  P = list(set(P) & set(s[k])) k range(len(s)) range len(s) len s P = list(set(P) & set(s[k])) P list(set(P) & set(s[k])) list set(P) & set(s[k]) set(P) set P set(s[k]) set s[k] s k print(len(P)) print len(P) len P A = list(map(lambda x: int(x), input().split(" "))) list(map(lambda x: int(x), input().split(" "))) A s = [] [] s P = [(i + 1) for i in range(M)] [(i + 1) for i in range(M)] P M = list(map(lambda a: int(a), input().split(" "))) list(map(lambda a: int(a), input().split(" "))) M P = list(set(P) & set(s[k])) list(set(P) & set(s[k])) P N, M = list(map(lambda a: int(a), input().split(" "))) list(map(lambda a: int(a), input().split(" "))) N
N, M = list(map(lambda a: int(a), input().split(" ")))
P = [(i + 1) for i in range(M)]
s = []
for j in range(N):
  A = list(map(lambda x: int(x), input().split(" ")))
  s.append(A[1:])
  
for k in range(len(s)):
  P = list(set(P) & set(s[k]))


print(len(P))