def main(): L, K = map(int, input().split()) half_length_of_pokky = L // 2 bite_count = half_length_of_pokky // K you_bite = K * bite_count if bite_count <= 0: print(0) elif you_bite == half_length_of_pokky: print(K * (bite_count - 1)) else: print(K * bite_count) if __name__ == '__main__': main()