import java.util.*; class y63 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double l = sc.nextInt(), k = sc.nextInt(); System.out.println((int)((Math.ceil(l/k/2)-1)*k)); } }