main = do [n, m] <- fmap (map read . words) getLine print $ if n <= m then 1 else if n `mod` 2 == 0 && n `div` 2 <= m then 2 else -1