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