#include int main(void){ int L,K; scanf("%d%d",&L,&K); printf("%d\n",K*(L%(2*K)==0?L/(2*K)-1:L/(2*K))); return 0; }