works = int(input()) days = int(input()) while days >= 1: works -= works // days ** 2 days -= 1 if days == 1: print(works) break