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