pascal = Array.new(51){Array.new(51, 0)}
pascal[0][0] = 1
1.upto(50){|n|
    pascal[n][0] = pascal[n][n] = 1
        1.upto(n / 2){|r|
            pascal[n][r] = pascal[n][n - r] = pascal[n - 1][r - 1] + pascal[n - 1][r]
        }
    }

l, k = gets.chomp.split.map(&:to_i)
sum, x = 0, 1
while true
    if x <= l
        sum += 1
        1.upto(x / 2 + 1){|y|
            if x + y * (k - 1) <= l
                sum += pascal[x / 2 + 1][y]
            else
                break
            end
        }
    else
        break
    end
    x += 2
end
puts sum

