L, K = map(int, input().split()) is_divisible = -1 if 0 == (L % (K*2)) else 0 print(K * ( (L // (K*2))+ is_divisible) )