import java.util.Scanner; class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int l = sc.nextInt() , k = sc.nextInt(); if(l % (k*2) != 0) { System.out.print((l / (k* 2))*k); }else { System.out.print((l / (k* 2) - 1)*k); } } }