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