import sys sys.setrecursionlimit(100000000) L,K = map(int,input().split(' ')) print((L-1)//(K*2)*K)