import java.util.Scanner; class S16_pochygame{ public static void main(String[] args){ int l, k, t; Scanner scn = new Scanner(System.in); l = scn.nextInt(); k = scn.nextInt(); t = l / (2 * k); if(l == (2 * k ) * t) t--; System.out.println(k * t); } }