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 x=1 for j in range(10**7): if x*a[0]>m: print(j+1) exit(0) x*=i if x%p==0: x//=p print(-1)