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