import java.util.Scanner; class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int W = in.nextInt(); int D = in.nextInt(); int temp = 0; for(int i=D; i>1; i--) { W -= (W / ((long)i * i)); } System.out.println(W); } }