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