import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) { BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in)); String line = ""; try { String[] temps = stdReader.readLine().split(" "); int L = Integer.parseInt(temps[0]); int K = Integer.parseInt(temps[1]); if(L%(2*K) != 0){ System.out.println(L/(2*K)*K); }else{ System.out.println((L/(2*K)-1)*K); } } catch (IOException e) { e.printStackTrace(); } } }