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