L,K=map(int,raw_input().split()) if L%(2*K)==0: num=L/(2*K)-1 else: num=L/(2*K) print num*K