import qualified Data.Map as M main = getLine >> getLine >>= main' . map read . words where main' xs = getLine >>= putStrLn . solve . M.fromListWith (+) . flip zip xs . map read . words solve :: M.Map Int Int -> String solve xs | k < mnum = "NO" | otherwise = "YES" where mnum = M.foldl max 0 xs k = err $ M.lookup 0 xs err (Just x) = x err _ = (-1)