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