import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(); int d = sc.nextInt(); int[] arr = new int[d + 1]; arr[d] = w; for (int i = d; i > 1; i--) { arr[i - 1] = (int)(arr[i] - arr[i] / ((long)i * i)); } System.out.println(arr[1]); } }