a, b = [int(x) for x in raw_input().split()]

new = a
old = 0
result = 0

while 1:
	old += new
	result += new
	new = 0
	if old >= b:
		new = old // b
		old -= ((old // b) * b)
	else:
		break

print result