list1 = list(map(int, input().split())) L= list1[0] K = list1[1] i = L while i > K*2: i = i - K*2 if i <= K*2: break print((L - i)//2)