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 / 2 <= K) { System.out.println(0); } else if (L % (K * 2) == 0) { System.out.println((L / K / 2 - 1) * K); } else { System.out.println(L / K / 2 * K); } } }