# -*- coding: utf-8 -*- import math W = input() D = input() for i in range(D, 1, -1): W -= math.floor(W / (i ** 2.0)) print int(W)