from Queue import * # Queue, LifoQueue, PriorityQueue
from bisect import * #bisect, insort
from datetime import * 
from collections import * #deque, Counter,OrderedDict,defaultdict
from sets import * #Set
import calendar
import heapq
import math
import copy
import itertools
myread = lambda : map(int,raw_input().split())
def solver():
    ans = 0
    a,b = myread()
    print a + (a-1)/(b-1)
    



if __name__ == "__main__":
    solver()
    
