L, K = map(int, input().split()) import math print(K*(math.ceil(L/(2*K))-1))