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