import Data.List

dfs :: Int -> Int -> [Int] -> [Int] -> (Bool, [Int])
dfs gn r cs ds
  | r < 1 = (True, ds ++ cs)
  | null cs = (False, ds)
  | otherwise = dfs gn r' cs' ds'
  where
    c = head cs
    r' = r - (c `div` gn)
    cs' = tail cs
    ds' = ds ++ [c `mod` gn]

solve (l1:l2)
  | result' && sum cs'' == 0 = "Yes"
  | otherwise = "No"
  where
    (h:w:_) = map read $ words l1
    cs = map length $ group $ sort $ concat l2
    g4 = (h `div` 2) * (w `div` 2)
    g2
      | odd h && odd w = (h `div` 2) + (w `div` 2)
      | odd h && even w = w `div` 2
      | even h && odd w = h `div` 2
      | otherwise = 0
    g1 = if odd h && odd w then 1 else 0
    step (result, cs') (gn, r)
      | result = dfs gn r cs' []
      | otherwise = (False, [])
    (result', cs'') = foldl' step (dfs 4 g4 cs []) [(2, g2), (1, g1)]

main = getContents >>= putStrLn.solve.lines
