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