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