# yukicoder No.51 やる気の問題 W = int(input()) D = int(input()) for i in range(D - 1): W -= int(W / (D ** 2)) D -= 1 print(W)