function main(input) {
  const args = input.split(" ");
  const A = Number(args[0]);
  const B = Number(args[1]);
  var ans = 0;
  if (A <= B) {
    ans = 0;
  } else {
    if (A <= B * 2) {
      ans = 0;
    } else {
      ans = A - B - B;
    }
  }

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
