import java.io.*; import java.lang.*; import java.util.*; import java.math.*; public class Main { static Scanner cin = new Scanner(System.in); public static void main(String[] args) { Long w=cin.nextLong(); Long d=cin.nextLong(); for(Long i=d; i>1; i--) w-=w/(i*i); System.out.println(w); } }