n, k, *_ = list(map(int, open(0).read().split()))

print(((n - 2) // (k - 1) + 1))
n, k = list(map(int, open(0).readline().split()))

print(((n - 2) // (k - 1) + 1))
n, k, *_ = list(map(int, open(0).read().split()))
print(((n - 2) // (k - 1) + 1))

n, k = list(map(int, open(0).readline().split()))
print(((n - 2) // (k - 1) + 1))

-n, k, *_ = list(map(int, open(0).read().split())) +n, k = list(map(int, open(0).readline().split()))