a, b = map(int, raw_input().split())
#smart solution but dont understand print (a*b-1)/(b-1)
r = 0
u = 0

while a > 0:
    a-=1
    r+=1
    u+=1

    if u == b:
        a += 1
        u -= b

print r
