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