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