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