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