#AV Drift King
inp=raw_input().split(" ")
a,b=map(int,inp)
noofcandle=a
noofcandlebo=0
noofhr=0
while(noofcandle>0):
	noofhr+=1
	noofcandle-=1
	noofcandlebo+=1
	if noofcandlebo==b:
		noofcandlebo=0
		noofcandle+=1
print noofhr	