import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(), tmp; tmp = n/(k*2); if(n%(k*2) == 0){ tmp--; } System.out.println(k*tmp); } }