import qualified Data.IntMap as M

rInt :: String -> Int
rInt = read

solve as bs
    | ba0 < mba = "NO"
    | otherwise = "YES"
    where
        ba = M.fromListWith (+) $ zip bs as
        ba0 = (\x -> case x of {Just x -> x; Nothing -> -1;} ) $ M.lookup 0 ba
        mba = M.foldr max 0 ba

main = do
    getLine
    as <- map rInt . words <$> getLine
    bs <- map rInt . words <$> getLine
    putStrLn $ solve as bs