def main():

    a,b = map(int,raw_input().split())
    
    solution = 0
    wentOut = 0
    
    while(a > 0 or wentOut >= b):
        if(a > 0):
            a-=1
            wentOut+=1
            solution+=1
        if(wentOut >= b):
            a+=1
            wentOut-=b

    print solution
            


main()