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