def lscan;gets.split.map(&:to_i);end require 'prime' n,h=lscan v=h.prime_division.to_h lscan.each{|a|a.prime_division.each{|q,c|v[q]-=c if v[q]}} puts v.all?{|q,c|c<=0}? 'YES': 'NO'