n,k=gets.split.map(&:to_i) p n/(2..n).find{|e|e%n==0}