main = do [n,m] <- map read . words <$> getLine :: IO [Int] print $ nsukumi n m nsukumi n m | m>2 = n-m+1 | otherwise = -1