import java.util.Scanner; public class Yukicoder63 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int L = sc.nextInt(); int K = sc.nextInt(); System.out.println((int)(K * (Math.ceil(L / (2.0 * K)) - 1))); } }