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