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