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