def solve(a, b):

    hours = a

    while a >= b:
        hours += (a/b)
        a = (a / b) + (a % b)

    return hours


if __name__ == "__main__":
    a, b = map(int, raw_input().split(" "))
    print solve(a, b)