class candle:
    def __init__(self):
        self.out = False

    def __str__(self):
        return 'Candle went out:' + str(out)

    def light(self):
        self.out = True

    def stat(self):
        return self.out


a = raw_input()
a = a.split()

init = int(a[0])
divide = int(a[1])
out = 0
hour = 0
while init > 0:
    init -= 1
    out += 1
    if out == divide:
        out = 0
        init += 1

    hour += 1
    
print hour
