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