L, K = map(int, raw_input().split()) ans = L/2/K*K if L % 2 == 0 and L/2 % K == 0: ans -= K print ans