N, K = list(map(int, input().split()))

A = list(map(int, input().split()))

i = A.index(1)

j = K-1

l = i

r = N - l - 1

ans, e = divmod(l, j)

if e:

    ans += 1

    r -= K - e - 1

ans += (r+j-1)//j

print(ans)
N,K=list(map(int, input().split()))

*A,=list(map(int, input().split()))



print((((N-1)+(K-1)-1)//(K-1)))
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
i = A.index(1)
j = K - 1
l = i
r = N - l - 1
ans, e = divmod(l, j)
if e:
    ans += 1
    r -= K - e - 1
ans += (r + j - 1) // j
print(ans)

N, K = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
print((((N - 1) + (K - 1) - 1) // (K - 1)))

-A = list(map(int, input().split())) -i = A.index(1) -j = K - 1 -l = i -r = N - l - 1 -ans, e = divmod(l, j) -if e: -    ans += 1 -    r -= K - e - 1 -ans += (r + j - 1) // j -print(ans) +(*A,) = list(map(int, input().split())) +print((((N - 1) + (K - 1) - 1) // (K - 1)))