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