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