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