h = Hash.new{0}

gets
as = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)
as.each_with_index do |a, idx|
  h[bs[idx]] += a
end

puts h[0] >= h.values.max ? "YES" : "NO"