n=gets.to_i a=gets.split.map(&:to_i) b=gets.split.map(&:to_i) score=Array.new(101,0) b.each_with_index{|i,j|score[i]+=a[j]} ks=score.shift others=score.max puts ks>=others ? "YES" : "NO"