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