w = int(input()) d = int(input()) while d > 1: w = w - w // (d * d) d -= 1 print(w)