import Data.List import Control.Applicative swap :: (a, b) -> (b, a) swap (x, y) = (y, x) eq :: Eq a => (a, a) -> (a, a) -> Bool eq x y = x == y || swap x == y solve :: Integral a => a -> a -> [a] -> String solve n k ds | t2 < 0 = "NO" | t2 `mod` 2 == 0 = "YES" | otherwise = "NO" where t1 = length $ filter (\(x, y) -> x /= y) $ nubBy eq $ zip ds [1..] t2 = k - fromIntegral t1 main = do [n, k] <- map read . words <$> getLine ds <- map read . words <$> getLine putStrLn $ solve n k ds