tmp= input().rstrip().split(' ')

N=int(tmp[0])

K=int(tmp[1])



tmp= input().rstrip().split(' ')

L = tmp.index("1")



out = L//(K-1) + (N-1-L)//(K-1)



if(L%(K-1)>0):

    out+=1

if((N-1-L)%(K-1)>0):

    out+=1



if ((L%(K-1)==0) or ((N-1-L)%(K-1)==0)):

    pass

elif((L%(K-1) + (N-1-L)%(K-1)) <= (K-1)):

        out -=1

    

print(out)
n,k = list(map(int, input().split()))

if n <= k:

    print((1))

else:

    if (n-1)%(k-1)==0:

        print(((n-1)//(k-1)))

    else:

        print(((n-1)//(k-1)+1))
tmp = input().rstrip().split(" ")
N = int(tmp[0])
K = int(tmp[1])
tmp = input().rstrip().split(" ")
L = tmp.index("1")
out = L // (K - 1) + (N - 1 - L) // (K - 1)
if L % (K - 1) > 0:
    out += 1
if (N - 1 - L) % (K - 1) > 0:
    out += 1
if (L % (K - 1) == 0) or ((N - 1 - L) % (K - 1) == 0):
    pass
elif (L % (K - 1) + (N - 1 - L) % (K - 1)) <= (K - 1):
    out -= 1
print(out)

n, k = list(map(int, input().split()))
if n <= k:
    print((1))
else:
    if (n - 1) % (k - 1) == 0:
        print(((n - 1) // (k - 1)))
    else:
        print(((n - 1) // (k - 1) + 1))

-tmp = input().rstrip().split(" ") -N = int(tmp[0]) -K = int(tmp[1]) -tmp = input().rstrip().split(" ") -L = tmp.index("1") -out = L // (K - 1) + (N - 1 - L) // (K - 1) -if L % (K - 1) > 0: -    out += 1 -if (N - 1 - L) % (K - 1) > 0: -    out += 1 -if (L % (K - 1) == 0) or ((N - 1 - L) % (K - 1) == 0): -    pass -elif (L % (K - 1) + (N - 1 - L) % (K - 1)) <= (K - 1): -    out -= 1 -print(out) +n, k = list(map(int, input().split())) +if n <= k: +    print((1)) +else: +    if (n - 1) % (k - 1) == 0: +        print(((n - 1) // (k - 1))) +    else: +        print(((n - 1) // (k - 1) + 1))