def retrieve_data():
    data = [int(x) for x in raw_input().split()]
    return data

def nyc(data):
    nyc = data[0]
    nyc_m = data[1]
    count = 1
    while count < nyc + 1:
        if count % nyc_m == 0:
            nyc = nyc + 1
        count = count + 1
    return nyc

def main():
    data = retrieve_data()
    print nyc(data)

if __name__ == '__main__':
    main()