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