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