N, M = map(int, input().split())
K =[set(input().split()[1:]) for _ in range(N)]
T = K[0]
for k in K:
  T = T&k
print(len(T)) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M set(input().split()[1:]) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) set(input().split()[1:]) set input().split()[1:] ().split() ().split () input split 1: 1 K =[set(input().split()[1:]) for _ in range(N)] K [set(input().split()[1:]) for _ in range(N)] T = K[0] T K[0] K 0 for k in K:
  T = T&k k K T = T&k T T&k T k print(len(T)) print len(T) len T T = K[0] K[0] T N, M = map(int, input().split()) map(int, input().split()) N K =[set(input().split()[1:]) for _ in range(N)] [set(input().split()[1:]) for _ in range(N)] K T = T&k T&k T M = map(int, input().split()) map(int, input().split()) M
N, M = map(int, input().split())
K =[set(input().split()[1:]) for _ in range(N)]
T = K[0]
for k in K:
  T = T&k
print(len(T))