import java.util.Scanner; public class Main51 { public static void main(String[] args) { Main51 p = new Main51(); } public Main51() { Scanner sc = new Scanner(System.in); long w = sc.nextLong(); long d = sc.nextLong(); solve(w, d); } public void solve(long w, long d) { for(long i=d;i>1;i--){ w -= w/i/i; } System.out.println(w); } }