import java.util.*; public class Kyosaya{ public static void main(String args[]) { Scanner s=new Scanner(System.in); int pocky = s.nextInt(); int gnaw = s.nextInt(); System.out.println(pocky-(pocky-(pocky/gnaw/2)*gnaw)); } }