fun main(args: Array<String>) {
    val (l, k) = readLine()!!.split(" ").map(String::toInt)
    val dp = Array(l + 1, {0L})
    dp[1] = 1
    if (k <= l) {
        dp[k] = 1
    }
    for (x in 2..l) {
        if (x - 2 >= 0) {
            dp[x] += dp[x - 2]
        }
        if (x - k - 1 >= 0) {
            dp[x] += dp[x - k - 1]
        }
    }
    println(dp.sum())
}
