import java.util.*; public class pocky{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int L = scan.nextInt(); int K = scan.nextInt(); System.out.println(eat(L,K)); } public static int eat(int l,int k){ return (l-1)/(k*2)*k; } }