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