a, b = map(int, raw_input().split())
new = a; burnt = 0
res = 0
while new > 0:
    res += new
    burnt += new
    new = 0
    reuse = burnt//b
    if reuse > 0:
        new += reuse
        burnt -= b*reuse
print res