inp = [int(l) for l in input().split()] L = inp[0]; K = inp[1] d,m = divmod(L,K*2) if m == 0: d -= 1 ans = K * d print(ans)