import Data.List

main :: IO ()
main = do
  [n,m] <- map read . words <$> getLine
  print $ solve n m

solve :: Int -> Int -> Int
solve n m | m `mod` n == 0 = m `div` n
          | even n = solve (n+1) m
          | otherwise = solve (n+2) m
