n,m,p,*a=map(int,open(0).read().split()) a.sort(reverse=True) for i in a: if i%p!=0 and i!=1: break if i%p==0 or i==1: print(-1) exit() x=1 j=0 while x<=m: x*=i j+=1 print(j)