L,K = map(int,input().split()) l = L // 2 if l % K == 0: print((l // K - 1) * K) else: print(l // K * K)