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