L, K = map(int, input().split()) L -= 1 # L / 2*K cnt = L//(2*K) print(cnt*K)