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