require "prime" require "set" A,B = gets.split.map(&:to_i) # Aの正負の約数を列挙してSetに包む v = Set.new(Prime.prime_division(A).map {|x| (0..x[1]).map{|e| x[0]**e}}.flatten.uniq.map{|x| [x] + [-x]}.flatten) puts v.include?(B) ? "YES" : "NO"