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