w = int(input()) d = int(input()) nokori = d while nokori >= 2: workload = w // (nokori ** 2) w = w - workload nokori -= 1 print(w)