#include int main() { int l, k; std::cin >> l >> k; std::cout << (l - 1) / 2 / k * k << std::endl; return 0; }