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