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