import sys
thing = raw_input("")
thing1 = thing.split(" ")
hours = 0
new = int(thing1[0])
count = int(thing1[1])
old = 0
while new > 0:
	old += new
	hours += new
	new = 0
	while old >= count:
		old -= count
		new += 1
print hours