L, K = map(int, input().split()) i = L / (2 * K) if i == 1: print(0) elif 2 > i > 1: print(K) else: print(int(i) * K)