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