import java.util.Scanner; public class No51 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(); int d = sc.nextInt(); sc.close(); for(int i = d; i > 1; i--){ w = w - (int)(w / Math.pow(i, 2)); } System.out.println(w); } }