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