{-# LANGUAGE Arrows #-} import Control.Monad import Control.Arrow import Data.List import Data.Ord getInts :: IO [Int] getInts = liftM (map read . words) getLine main = do _ <- getLine as <- getInts bs <- getInts let cs = map ((fst . head) &&& (sum . map snd)) . groupBy (\a b -> fst a == fst b) $ sortBy (comparing fst) $ zip bs as f = if fst (head cs) /= 0 then 0 else snd (head cs) putStrLn $ if f >= maximum (map snd cs) then "YES" else "NO"