n,m,p,*a=map(int,open(0).read().split()) a.sort(reverse=True) b=[] for i in a: while i%p==0: i//=p b+=[i] b.sort(reverse=True) x=1 j=0 while x<=m: if x*a[0]>m: print(j+1) exit() if b[0]==1: print(-1) exit() x*=b[0] j+=1