L,K = map(int,input().split()) eat_count = L // (2 * K) if a != 1: print(eat_count * K) else: print(a - 1)