import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    const tmp = readln.split.to!(long[]);
    const N = tmp[0], K = tmp[1];
    const as = readln.split.to!(long[]);
    const i = N.iota.reduce!((a,b) => as[a] < as[b] ? a : b);
    //i番目からK-1ずつ降りていって、何回目に0になれるか？
    const l = cast(long)ceil(cast(double)i / (K-1));
    const r = cast(long)ceil(cast(double)(N-1-i) / (K-1));
    writeln(l+r);
}
