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