#include using namespace std; int main() { int l, k; cin >> l >> k; int temp = (l - 1) / (2 * k); int ans = temp * k; cout << ans << endl; }