ab = raw_input().split()
a = int(ab[0])
b = int(ab[1])
hours = 0
wentOut = 0
while a > 0:
    a -= 1
    hours += 1
    wentOut += 1
    if wentOut == b:
        wentOut = 0
        a += 1
print hours