import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  n <- readLn :: IO Int
  k <- readLn :: IO Int
  (print .last .take (n+1) .iterate (f k)) 1
  
f k x | x*2<x+k = x*2 | otherwise = x+k