w = int(input()) d = int(input()) x = 0 for i in range(d,1,-1): #rint(w) w -= int(w/(i*i)) print(w)