local n, k = io.read("*n", "*n")
local c = 0
for i = 1, n do
  local a = io.read("*n")
  if a == 1 then
    c = i
  end
end
local r = math.ceil((c - 1) / (k - 1))
c = 1 + r * (k - 1)
if c < n then
  r = r + math.ceil((n - c) / (k - 1))
end
print(r)
