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 j=0 while x<=m: if x*max(a)>m: print(j+1) exit(0) elif i%p==0 or i==1: print(-1) exit() x*=i j+=1 print(j)