#include int main(void){ int l,k; scanf("%d%d",&l,&k); if(l%(2*k) == 0){printf("%d\n",(l/(2*k)-1)*k);} else{printf("%d\n",(l/(2*k))*k);} return 0; }