n,x,Q=map(int,input().split()) e=0 for _ in range(Q): m=int(input()) f=list(map(int,input().split())) if x in f: e+=1 elif len(set(f))