import sys read=sys.stdin.buffer.read W,D=map(int,read().split()) for d in range(D,1,-1): W-=W//d**2 print(W)