import math

N, K, *A = list(map(int, open(0).read().split()))

I = A.index(1)

print((math.ceil((N-1)/(K-1))))
N, K = list(map(int, input().split()))

print(((N+K-3)//(K-1)))

import math

N, K, *A = list(map(int, open(0).read().split()))
I = A.index(1)
print((math.ceil((N - 1) / (K - 1))))

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

-import math - -N, K, *A = list(map(int, open(0).read().split())) -I = A.index(1) -print((math.ceil((N - 1) / (K - 1)))) +N, K = list(map(int, input().split())) +print(((N + K - 3) // (K - 1)))