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