L, K = map(int, input().split()) Y = 0 while(L > 2*K): Y += K L -= 2*K print(Y)