def main(): W = int(input()) D = int(input()) for rest in reversed(range(2, D+1)): W -= W // rest**2 print(W) if __name__ == "__main__": main()