import Control.Applicative

main :: IO ()
main = print =<< solve <$> getLine <*> getLine

solve :: String -> String -> Int
solve n' k' = solve' 1 n k
  where n = read n' :: Int
        k = read k' :: Int

solve' :: Int -> Int -> Int -> Int
solve' c 0 k = c
solve' c n k = solve' (c + if c < k then c else k) (n-1) k