import numpy as np
#import pdb

tmp = list(map(int, input().strip().split(' ')))
N = tmp[0]
K = tmp[1]
A = list(map(int, input().strip().split(' ')))

A = np.asarray(A)
pos = np.argmin(A)

"""
pos = np.where(A == A.min())[0]
#pdb.set_trace()

tmp = -1
ans = 0
for pos_one in pos:
    ans += np.ceil((pos_one - tmp - 1) / (K-1))
    tmp = pos_one

ans += np.ceil((N - tmp - 1) / (K-1))
print(ans.astype(np.uint64))
"""

left = pos
right = N - pos - 1

if N <= K:
    print(1)
elif right + 1 <= K and left + 1 <= K:
    print(2)
elif right + 1 <= K:
    left -= K - (right + 1)
    left_count = np.ceil(left / (K-1))
    right_count = np.ceil(right / (K-1))
    print((left_count + right_count).astype(np.uint64))
elif left + 1 <= K:
    right -= K - (left + 1)
    left_count = np.ceil(left / (K-1))
    right_count = np.ceil(right / (K-1))
    print((left_count + right_count).astype(np.uint64))
else:
    left_count = np.ceil(left / (K-1))
    hamide = K - (left % (K - 1)) - 1
    right = right - hamide
    right_count = np.ceil(right / (K-1))
    print((left_count + right_count).astype(np.uint64))
