import java.util.*; class test{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int W = sc.nextInt(); long D = sc.nextInt(); if(D != 1){ for(long i=D; i>1; i--){ W -= W / (i * i); } } System.out.println(W); } }