function Main(input) {
    input = input.split("\n");
    tmp = input[0].split(" ");
    var n = parseInt(tmp[0], 10);
    var m = parseInt(tmp[1], 10);
    var res=Math.ceil((n-1)/(m-1));
    console.log('%d', res);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));