n,m,q=gets.split.map(&:to_i) m+=1 a=gets.split.map(&:to_i) if a.max>=m puts 1 exit end l=[] mq=0 nq=0 ans=1/0.0 a.each do |aa| if aa%q==0 mq=aa if mq0&&mq>nq m=(m-1)/mq+1 c=1 end if m>1&&nq==0 puts "-1" exit end x=1 while x