W = int(input()) D = int(input()) while D > 1: W -= W // pow(D, 2) D -= 1 print(W)