L,K = map(int, input().split()) count = 0 while L-(2*K)*count > 0: count += 1 print((count-1) * K)