#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
import sys, io
import re, math
start = time.clock()
#n=int(raw_input())
(a,b)=map(int, raw_input().split())
k=a
while 1:
    if k>1.0:
        k=k*1.0
        a+=k/b
        k=k/b
    else:
        break
print int(a)