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