W,D = input(),input() while D > 1: W -= int((W*1.0 / (D * D))) D -= 1 print W