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