import java.util.Scanner; public class Main{ static final Scanner s=new Scanner(System.in); public static void main(String args[]){ int n=s.nextInt(),k=s.nextInt(); System.out.println((n-1)/(k*2)*k); } }