#include using namespace std; int main() { int len, x; int num; cin >> len >> x; num = len / 2; if (num%x != 0) { cout << (num / x) * x << endl; } else { if (num / x != 0) { cout << (num / x - 1) * x << endl; } else { cout << 0 << endl; } } return 0; }