package yukicoder; import java.util.Scanner; public class N51 { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int w = sc.nextInt(); int d = sc.nextInt(); for(int i = 0;i < d - 1;++i){ w -= Math.floor(w/(Math.pow(d - i, 2))); } System.out.println(w); } }