import math W= input() D= input() for i in range(D+1): today_W= math.floor(W / D**2) W= W - today_W print(W)