import math L, K = map(int, input().split()) eat_times = int(math.ceil(L / K)) y_times = 0 h_times = 0 if eat_times % 2 == 0: y_times = int((eat_times - 2) / 2) h_times = y_times + 2 else: y_times = int((eat_times - 1) / 2) h_times = y_times + 1 print(K * y_times)