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 r =L/(2*K); if(L%(2*K)==0){ r=r-1; } int a=r*K; System.out.println(a); } }