function Main(input)
{
  input = input.split(" ");
  var k = parseInt(input[0],10);
  var n = parseInt(input[1],10);
  var ret = k - n + 1;
  if( ret < 0 ) ret = 0;
  console.log("%d",ret);
}

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