#include "bits/stdc++.h" using namespace std; int main(){ int L, K; cin >> L >> K; int turn = (L - 1) / (2 * K); int ans = turn * K; cout << ans << endl; }