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