import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List
import Data.Ord
import qualified Data.Set as S

solve :: [Int] -> [Int] -> Bool
solve ts ds = go ts S.empty
  where
    dz = zip [0..] ds
    go [] _ = True
    go (t:ts) s
      | t == 0 = go ts s
      | otherwise =
          case findIndex (\(i,d) -> t >= d && S.notMember i s) dz of
            Just i -> let d = (ds!!i)
                       in go ((t-d):ts) (S.insert i s)
            Nothing -> False

main :: IO ()
main = do
    n <- readLn :: IO Int
    d <- sortOn Down . map (fst . fromJust . BS.readInt)
        . BS.words <$> BS.getLine :: IO [Int]
    m <- readLn :: IO Int
    t <- sort . map (fst . fromJust . BS.readInt)
        . BS.words <$> BS.getLine :: IO [Int]
    putStrLn $ if solve t d then "YES" else "NO"
