import math W = int(input()) D = int(input()) while D > 1: W += -(math.floor((W/(D**2)))) D += -1 print(W)