L,K = map(int,raw_input().split()) if (L%(K*2)==0): num_graw = L/(K*2)-1 else: num_graw = int(L/(K*2)) print num_graw*K