w = io.read() - 0 d = io.read() - 0 for i = d, 2, -1 do w = w - math.floor(w / (i * i)) end print(w)