#include int main() { int L,K; scanf("%d%d",&L,&K); if(L<=K*2){ printf("%d",L); }else if(L%(K*2)==0){ printf("%d",L/2+K); }else{ printf("%d",L/K+K); } return 0; }