l,k = map(int,input().split()) print((l-1)//(2*k)*k)