require 'prime' n,k = gets.split.map(&:to_i) a = Prime.prime_division(n)[0][0] if a > k p 1 else p n / a end