import java.util.Scanner; class N051{ public static void main(String args[]){ Scanner s = new Scanner(System.in); int w = s.nextInt(); long d = s.nextLong(); long a = d - 1; for(int i = 0; i < a; i++){ w -= w / (d * d); d--; } System.out.println(w); } }