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