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