#include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair P; int main(){ int l,k; cin >> l >> k; int ret = l / (2 * k) * k; if(ret * 2 == l)ret -= k; cout << ret << endl; return 0; }