[a,b] = map(int,raw_input().split())
s = 0
j = 0
while True :
    if s >= b :
        j = j + 1
        s = s - ( b - 1 )
    elif a >= 1 :
        a = a - 1
        j = j + 1
        s = s + 1
    else :
        break
print j