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