#include using namespace std; int main(){ int l,k,ans; cin>>l>>k; ans=(ceil((double)l/(2*k))-1)*k; cout<