from math import ceil

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

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



left=0

right=0

for i in range(N):

  if A[i]==1:

    left=i

    right=N-(i+1)

ans=ceil((left+right)/(K-1))

print(ans)





from math import ceil



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

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

if K==N:

    print((1))

    exit()

print((ceil((N-1)/(K-1))))
from math import ceil

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
left = 0
right = 0
for i in range(N):
    if A[i] == 1:
        left = i
        right = N - (i + 1)
ans = ceil((left + right) / (K - 1))
print(ans)

from math import ceil

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
if K == N:
    print((1))
    exit()
print((ceil((N - 1) / (K - 1))))

-left = 0 -right = 0 -for i in range(N): -    if A[i] == 1: -        left = i -        right = N - (i + 1) -ans = ceil((left + right) / (K - 1)) -print(ans) +if K == N: +    print((1)) +    exit() +print((ceil((N - 1) / (K - 1))))