import Control.Arrow
import Data.List

main :: IO ()
main = getLine >>= main' . map read . words
    where
        main' [n, m] = getLine >> getLine >>= putStrLn . solve n m . map read . words

solve :: Int -> Int -> [Int] -> String
solve n m xs
    | null ys  = "Yes"
    | check m xs = "Yes"
    | otherwise = "No"
    where
        ys = filter ((> 0) . (`mod` n) . length) . group . sort . filter (> 1) $ xs

check :: Int -> [Int] -> Bool
check m xs = ys == 1
    where
        ys = length . group . map length . group . sort $ xs
