#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 { cout << (num / x - 1) * x << endl; } return 0; }