from __future__ import division
from collections import Counter as ctr
import math
def rl():
	return [int(i) for i in raw_input().split()]

def rm(n=None):
	if n is None:
		n = input()
	return [raw_input() for i in range(n)]

def rlm(n=None):
	if n is None:
		n = input()
	return [rl() for i in range(n)]

def yn(b):
	if b:
		print "YES"
	else:
		print "NO"

a, b = rl()
tot = 0
pieces = 0
for i in range(1000):
	tot += a
	pieces += a
	a = pieces // b
	pieces = pieces % b
print int(tot)