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

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc2(int lo, int hi, int k, int[] xs) {
   int ans = 0;
   int x = lo;
   while (x-1 >= 0) {
       ans++;
       x -= k - 1;
   }

   x = hi;
   while (x+1 < xs.length) {
       ans++;
       x += k - 1;
   }

   // writeln(lo, " ", hi, " ans ", ans);
   return ans;
}

int calc(int k, int[] xs) {
   int p = 0;
   for (int i = 0; i < xs.length; i++) {
       if (xs[i] == 1) {
           p = i;
           break;
       }
   }

   int ans = int.max;
   int lo = max(0, p - k + 1);
   int hi = min(xs.length, p + k - 1);
   for (int i = max(0, p - k + 1); i <= p; i++) {
       ans = min(ans, 1 + calc2(i, i + k - 1, k, xs));
   }
   return ans;


}

void main() {
    auto nk = readints;
    int k = nk[1];
    auto xs = readints;

    auto ans = calc(k, xs);
    writeln(ans);
}