#include using namespace std; int main() { int L, K; cin >> L >> K; const int half = L / 2; int n = half / K; if (half % K == 0) --n; int answer = K * n; cout << answer << endl; return 0; }