import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int w = sc.nextInt(); int d = sc.nextInt(); while (d > 1) { w -= w/d/d; d--; } System.out.println(w); } }