# -*- coding: utf-8 -*-
#A. Новогодние свечки

R = lambda: map(int, raw_input().split())


def main():
    a, b = R()
    result = a
    while True:

        result += a / b
        a = a / b + a % b
        if a < b:
            break
    print result

main()
