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