function main(input) { 
  let continuityNum = input.split(" ");
  let selectNum = input.split(" ")[1];
 
  
  let nowNum = 1;
  let endFlg = 0;
  
  var count = 0;
  while(1){
    var judge　= nowNum;
    if(Number(judge) + Number(selectNum) -1 <= continuityNum){
        nowNum++;
      	count++;
   	}else{
        console.log(count);
      	break;
    }
  }
}

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