l, k = map(int, input().split(' ')) cnt = 0 if l%(k*2) == 0: print(k*(l//(2*k))-k) else: print(k*(l//(2*k)))