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