a,b = map(int,input().split()) count = (a - 1) // (b * 2) print(count * b)