object Main extends App {
    val scanner = new java.util.Scanner(System.in)
    val n = scanner.next().toInt
    val k = scanner.next().toInt
    println(sim(1, k, n).min)
    
    def sim(n: Int, k: Int, cnt: Int): List[Int] = {
        if (cnt == 0) { 
            List(n)
        } else {
            sim(n+k, k, cnt-1) ::: sim(n*2, k, cnt-1)
        }
    }
}