#include "bits/stdc++.h" using namespace std; #define REP(i, n) for(int i=0; i<(n); i++) int L,K; signed main() { cin >> L >> K; cout << (L-1) / K / 2 * K << endl; return 0; }