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