l, k = [int(i) for i in input().split()] ans = int((l - 1) / (k * 2)) * k print(ans)