import sys

input = sys.stdin.readline

ins = lambda: input().rstrip()

ini = lambda: int(input().rstrip())

inm = lambda: map(int, input().split())

inl = lambda: list(map(int, input().split()))

out = lambda x: print('\n'.join(map(str, x)))

ceil = lambda a, b: (a + b - 1) // b



n, k = inm()

a = inl()

start = a.index(1)

ans = 10**9

for i in range(max(0, start-k+1), min(n-1, start+k)):

    ans = min(ans, ceil(i, k-1) + ceil(n-i-1, k-1))

print(ans)

import sys

input = sys.stdin.readline

ins = lambda: input().rstrip()

ini = lambda: int(input().rstrip())

inm = lambda: map(int, input().split())

inl = lambda: list(map(int, input().split()))

out = lambda x: print('\n'.join(map(str, x)))

ceil = lambda a, b: (a + b - 1) // b



n, k = inm()

a = inl()

print(ceil(n-1, k-1))

import sys

input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print("\n".join(map(str, x)))
ceil = lambda a, b: (a + b - 1) // b
n, k = inm()
a = inl()
start = a.index(1)
ans = 10**9
for i in range(max(0, start - k + 1), min(n - 1, start + k)):
    ans = min(ans, ceil(i, k - 1) + ceil(n - i - 1, k - 1))
print(ans)

import sys

input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print("\n".join(map(str, x)))
ceil = lambda a, b: (a + b - 1) // b
n, k = inm()
a = inl()
print(ceil(n - 1, k - 1))

-start = a.index(1) -ans = 10**9 -for i in range(max(0, start - k + 1), min(n - 1, start + k)): -    ans = min(ans, ceil(i, k - 1) + ceil(n - i - 1, k - 1)) -print(ans) +print(ceil(n - 1, k - 1))