l, k = list(map(int, input().split())) x = (l-1) // (k*2) print(x * k)