L,K = map(int, raw_input().split()) print max(0,(L / (2 * K) - 1) * K)