W = int(input()) D = int(input()) for n in range(D-1): W -= W//(D*D) D -= 1 print(W)