#include using namespace std; int main() { int L, K; cin >> L >> K; int ans = L / (2 * K) * K; if (2 * ans == L) ans -= K; cout << ans << endl; }