ch = 0
ost = 0
s = raw_input()
s = s.split()
n = int(s[0])
b = int(s[1])
while n > 0 or ost >= b:
    if n > 0:
        ost = ost + 1
        ch = ch + 1
        n = n - 1
    if ost == b:
        n = n + 1
        ost = ost - b
print ch
    
