#include using namespace std; int main() { int L, K; cin >> L >> K; int sub = K; while (L > sub * 2) { sub += K; } cout << sub - K << endl; return 0; }