import math m = list(map(int,input().split())) L = m[0] K = m[1] s = math.floor(L/(2*K)) if L/(2*K) - s != 0: print(s * K) else: print((s-1) * K)