loop do
  n,m = gets.split.map(&:to_i)
  break if (n|m)==0
  ord = (1..n).to_a
  imp = gets.split.map(&:to_i)
  div = [2,3,5,7]
  div.each{|d|
    if imp.include?(d)
      (d*2).step(20,d){|i| imp.delete(i)}
    end
  }
  imp.each{|i|
    i.step(n,i).each{|x|
      ord.delete(x)
    }
  }
  sum=ord.inject(0){|sum,x| sum+x}
  printf("%.10f\n",ord.size != 0 ? 1.0*sum/ord.size : 0)
end