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