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