var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
function min(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<val)val = rest[i];return val}
function max(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>val)val = rest[i];return val}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

function Main(input){
	var input = input.split('\n');
	var input1 = input[0].split(' ');
	var n = toInt(input1[0]);
	var k = toInt(input1[1]);
	//var as = toIntArr(input[1]);
	var ans = Math.floor((n-1)/(k-1));
	console.log(ans);
}
