import math W = int(input()) D = int(input()) for d in range(D, 1, -1): W = W - math.floor(W/(d**2)) print(W)