import java.util.Scanner; public class No63 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int L = sc.nextInt(); int K = sc.nextInt(); if (L % (K * 2) == 0) { System.out.println((L / K / 2 - 1) * K); } else { System.out.println(L / K / 2 * K); } } }