import java.util.*; public class Yukicoder_63{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); int L = stdIn.nextInt(); int K = stdIn.nextInt(); int count = L/(2*K); if(L == K*count*2){ System.out.println(K*(count-1)); } else{ System.out.println(K*count); } } }