L, K = map(int, input().split()) y = 0 if(K == 1): if(L%2 == 0): y = int(L/2) -1 else: y = int(L/2) L = 0 while(L > 2*K): y += K L -= 2*K print(y)