import java.util.Scanner; public class No51 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int work = s.nextInt(); int day = s.nextInt(); while (day > 1) { work -= work / (day * day); day--; } System.out.println(work); } }