There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
 - Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.
Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.
Find the minimum number of operations required.
It can be proved that, Under the constraints of this problem, this objective is always achievable.

-----Constraints-----
 - 2 \leq K \leq N \leq 100000
 - A_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.

-----Input-----
Input is given from Standard Input in the following format:
N K
A_1 A_2 ... A_N

-----Output-----
Print the minimum number of operations required.

-----Sample Input-----
4 3
2 3 1 4

-----Sample Output-----
2

One optimal strategy is as follows:
 - In the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.
 - In the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.

Difficulty: MEDIUM_HARD

Solutions:
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
if N == K:
	print(1)
else:
	ans = 1
	N -= K
	while N > 0:
		ans += 1
		N -= K - 1
	print(ans)


import collections
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = collections.Counter(a)
length = n - c.most_common()[0][1] + 1
if length == 1:
	ans = 0
else:
	ans = (length + k - 3) // (k - 1)
print(ans)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
import math
if n > k:
	min = math.ceil((n - k) / (k - 1))
	print(min + 1)
elif n == k:
	print(1)


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


from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
(n, k) = inpl()
a = inpl()
k -= 1
print((n - 1 + k - 1) // k)


import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

def int1(x):
	return int(x) - 1

def II():
	return int(input())

def MI():
	return list(map(int, input().split()))

def MI1():
	return list(map(int1, input().split()))

def LI():
	return list(map(int, input().split()))

def LI1():
	return list(map(int1, input().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def MS():
	return input().split()

def LS():
	return list(input())

def LLS(rows_number):
	return [LS() for _ in range(rows_number)]
INF = float('inf')
from math import ceil, floor, log2, log, sqrt
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
from collections import deque, defaultdict
from pprint import pprint

def solve():
	(N, K) = MI()
	print(ceil((N - 1) / (K - 1)))

def __starting_point():
	solve()
__starting_point()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
if n == k:
	print(1)
else:
	print(-(-(n - 1) // (k - 1)))


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
ind = A.index(1)
n = ind // (K - 1)
if ind % (K - 1):
	n += 1
m = (N - 1 - ind) // (K - 1)
if (N - 1 - ind) % (K - 1):
	m += 1
cmin = n + m
for i in range(max(1, ind + K - N), min(ind, K - 1) + 1):
	n = (ind - i) // (K - 1)
	if (ind - i) % (K - 1):
		n += 1
	m = (N - ind - K + i) // (K - 1)
	if (N - ind - K + i) % (K - 1):
		m += 1
	cnt = n + m + 1
	cmin = min(cmin, cnt)
print(cmin)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
(a, mod) = divmod(N - 1, K - 1)
if mod == 0:
	print(a)
else:
	print(a + 1)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
N -= K
ans = 1
if N <= 0:
	print(ans)
	return
import math
ans += math.ceil(N / (K - 1))
print(ans)


(n, k) = map(int, input().split())
print((n - 1 + k - 2) // (k - 1))


from sys import stdin, stdout
from itertools import permutations

def read_int_from_line():
	return list(map(int, input().split()))

def solve():
	(n, k) = read_int_from_line()
	a = read_int_from_line()
	if (n - 1) % (k - 1) == 0:
		ans = (n - 1) // (k - 1)
	else:
		ans = (n - 1) // (k - 1) + 1
	print(ans)

def main():
	solve()

def __starting_point():
	main()
__starting_point()


(N, K) = map(int, input().split())
arr = list(map(int, input().split()))
cnt = 0
correction_value = 0
for i in range(0, N, K - 1):
	cnt += 1
	if i + correction_value + K >= N:
		break
	else:
		for j in range(1, K):
			arr[j] = min(arr[j], arr[j - 1])
		if arr[i + correction_value + K] == arr[i + correction_value + K - 1]:
			correction_value += 1
print(cnt)


(n, k) = list(map(int, input().split()))
List = list(map(int, input().split()))
import math
ans = math.ceil((n - 1) / (k - 1))
print(ans)


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


import sys
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
if K == 2:
	print(N - 1)
	return
if N % K == 0:
	print((len(A) - 1) // (K - 1))
else:
	print((len(A) - 1) // (K - 1) + 1)


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

def __starting_point():
	main()
__starting_point()


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
ind1 = 0
for (i, a) in enumerate(A):
	if a == 1:
		ind1 = i
		break
left = ind1
right = N - ind1 - 1
ans = 0
(a, b) = divmod(left, K - 1)
a += 1 if b > 0 else 0
ans += a
if b > 0:
	right -= K - 1 - b
(a, b) = divmod(right, K - 1)
a += 1 if b > 0 else 0
ans += a
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
print((n - 1 + k - 2) // (k - 1))


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


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
n = N - 1
k = K - 1
ans = (n + k - 1) // k
print(ans)


(N, K) = list(map(int, input().split()))
a = list(map(int, input().split()))
tmp = (N - 1) // (K - 1)
if tmp * (K - 1) == N - 1:
	print(tmp)
else:
	print(tmp + 1)


import math
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
min_a = min(A)
c = A.count(min_a)
ans = math.ceil((N - c) / (K - 1))
print(ans)


(N, K) = map(int, input().split())
(*A,) = map(int, input().split())
now = 0
ans = 0
while now < N:
	ans += 1
	now += K
	if now >= N:
		break
	now -= 1
print(ans)


import math
(n, k) = list(map(int, input().split()))
A = list(map(int, input().split()))
print(math.ceil((n - 1) / (k - 1)))


import math

def main():
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	n = n - 1
	k = k - 1
	print(math.ceil(n / k))

def __starting_point():
	main()
__starting_point()


(N, K) = map(int, input().split())
if (N - K) % (K - 1) == 0:
	print((N - K) // (K - 1) + 1)
else:
	print((N - K) // (K - 1) + 2)


(n, k) = list(map(int, input().split()))
lis = list(map(int, input().split()))
left = 0
if n == k:
	print(1)
	return
if n // 2 < k:
	print(2)
	return
for i in range(n):
	if lis[i] == 1:
		break
	else:
		left += 1
right = n - left - 1
k = k - 1
left_ans = 0
right_ans = 0
if left % k == 0:
	left_ans += left // k
	if right % k == 0:
		left_ans += right // k
	else:
		left_ans += right // k + 1
else:
	left_ans += left // k + 1
	right_tmp = right - (k - left % k)
	if right_tmp % k == 0:
		left_ans += right_tmp // k
	else:
		left_ans += right_tmp // k + 1
if right % k == 0:
	right_ans += right // k
	if left % k == 0:
		right_ans += left // k
	else:
		right_ans += left // k + 1
else:
	right_ans += right // k + 1
	left_tmp = left - (k - right % k)
	if left_tmp < 1:
		pass
	elif left_tmp % k == 0:
		right_ans += left_tmp // k
	else:
		right_ans += left_tmp // k + 1
print(min(left_ans, right_ans))


(N, K) = list(map(int, input().split()))
A = list((int(x) for x in input().split()))
if N <= 3:
	print(1)
	return
print(-(-(N - 1) // (K - 1)))


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


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


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
start = a.index(1)
left = start
x = math.ceil(left / (k - 1))
excess = x * (k - 1) - left
right = max(n - start - 1 - excess, 0)
y = math.ceil(right / (k - 1))
print(x + y)


(n, k) = map(int, input().split())
ans = 0
s = 0
while s < n:
	if s == 0:
		s += k
	else:
		s += k - 1
	ans += 1
print(ans)


import sys
readline = sys.stdin.readline
read = sys.stdin.read
(n, k) = list(map(int, readline().split()))
(*a,) = list(map(int, readline().split()))
ans = 1 + (n - 1 - 1) // (k - 1)
print(ans)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
val_memo = {}
for i in range(N):
	if A[i] in val_memo:
		val_memo[A[i]] += 1
	else:
		val_memo[A[i]] = 1
val_memo = sorted(val_memo.items(), key=lambda x: x[0])
total = N - val_memo[0][1]
if total % (K - 1):
	print(total // (K - 1) + 1)
else:
	print(total // (K - 1))


import os
import sys
import numpy as np

def main():
	(N, K) = list(map(int, input().split()))
	A = np.array(list(map(int, input().split())))
	cnt = 0
	i = 0
	while i != N - 1:
		if i == 0:
			A[i:i + K] = np.min(A[i:i + K])
			cnt += 1
			i = i + K - 1
		elif i + K < N:
			A[i:i + K] = A[i]
			cnt += 1
			i = i + K - 1
		else:
			A[i:-1] = A[i]
			cnt += 1
			break
	print(cnt)

def __starting_point():
	main()
__starting_point()


import sys
import math
import itertools
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
input = sys.stdin.readline

def RD():
	return input().rstrip()

def F():
	return float(input().rstrip())

def I():
	return int(input().rstrip())

def MI():
	return map(int, input().split())

def MF():
	return map(float, input().split())

def LI():
	return list(map(int, input().split()))

def TI():
	return tuple(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def Init(H, W, num):
	return [[num for i in range(W)] for j in range(H)]

def main():
	(N, K) = MI()
	ans = 1
	N -= K
	ans -= -N // (K - 1)
	print(ans)

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(cnt, ttl) = (1, k)
while ttl < n:
	ttl += k - 1
	cnt += 1
print(cnt)


import sys, bisect, math, itertools, string, queue, copy, heapq, collections, itertools
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7

def inp():
	return int(input())

def inpm():
	return map(int, input().split())

def inpl():
	return list(map(int, input().split()))

def inpls():
	return list(input().split())

def inplm(n):
	return list((int(input()) for _ in range(n)))

def inplL(n):
	return [list(input()) for _ in range(n)]

def inplT(n):
	return [tuple(input()) for _ in range(n)]

def inpll(n):
	return [list(map(int, input().split())) for _ in range(n)]

def inplt(n):
	return [tuple(map(int, input().split())) for _ in range(n)]

def inplls(n):
	return sorted([list(map(int, input().split())) for _ in range(n)])
(n, k) = inpm()
A = inpl()
print(math.ceil((n - 1) / (k - 1)))


(N, K) = map(int, input().split())
data = list(map(int, input().split()))
s = (N - K) // (K - 1)
a = (N - K) % (K - 1)
if a == 0:
	print(s + 1)
else:
	print(s + 2)


import sys
import math
import collections
input = sys.stdin.readline
(N, K) = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = math.ceil((N - 1) / (K - 1))
print(ans)


def main():
	(N, K) = list(map(int, input().split()))
	ans = 0 if (N - 1) % (K - 1) == 0 else 1
	ans += (N - 1) // (K - 1)
	print(ans)

def __starting_point():
	main()
__starting_point()


from math import ceil
(n, k) = map(int, input().split(' '))
input()
print(ceil((n - 1) / (k - 1)))


import sys
import math

def input():
	return sys.stdin.readline().strip()
sys.setrecursionlimit(250000)

def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	sum_ = n
	count = 0
	while sum_ > 0:
		if sum_ > k:
			sum_ = sum_ - k + 1
			count += 1
		else:
			sum_ = 0
			count += 1
	print(count)

def __starting_point():
	main()
__starting_point()


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


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


from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
(n, k) = inpl()
a = inpl()
now = 0
res = 0
for x in a:
	if x != 1:
		now += 1
	if now == k - 1:
		res += 1
		now = 0
if now:
	res += 1
print(res)


(n, k) = map(int, input().split())
_ = list(map(int, input().split()))
print((n - 1 + k - 2) // (k - 1))


import sys
from math import ceil
MOD = 10 ** 9 + 7
INF = float('inf')
(N, K) = list(map(int, input().split()))
A = list(map(int, input().split()))
res = ceil((N - K) / (K - 1)) + 1
if N <= K:
	res = 1
print('{}'.format(res))


(N, K) = list(map(int, input().split()))
A = list(map(int, input().split()))
N -= K
res = 1
if N > 0:
	res += (N + (K - 1) - 1) // (K - 1)
print(res)


(N, K) = map(int, input().split())
a = list(map(int, input().split()))
if N == K:
	print(1)
else:
	tmp = N - K
	if tmp % (K - 1) == 0:
		print(1 + tmp // (K - 1))
	else:
		ans = 2 + tmp // (K - 1)
		print(ans)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
if N <= K:
	print(1)
elif (N - 1) % (K - 1) == 0:
	print((N - 1) // (K - 1))
else:
	print((N - 1) // (K - 1) + 1)


(N, K) = input().split()
N = int(N)
K = int(K)
import math
if N == K:
	print(1)
else:
	print(math.ceil((N - K) / (K - 1)) + 1)


(n, k) = list(map(int, input().split()))
a_s = list(map(int, input().split()))
print((n - 2) // (k - 1) + 1)


import math
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
if N == K:
	print(1)
	return
mi = 0
for i in range(N):
	if A[i] == 1:
		mi = i
		break
mc = N
for i in range(K):
	c = 1
	if mi - i > 0:
		c += math.ceil((mi - i) / (K - 1))
	if mi + K - 1 - i < N:
		c += math.ceil((N - (mi + K - 1 - i) - 1) / (K - 1))
	if c < mc:
		mc = c
print(mc)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
index = A.index(1)
ans = index // (k - 1) + (n - index - 1) // (k - 1)
right = index % (k - 1)
left = (n - index - 1) % (k - 1)
if right:
	if left:
		if right + left <= k - 1:
			ans += 1
		else:
			ans += 2
	else:
		ans += 1
elif left:
	ans += 1
print(ans)


import sys

def MI():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))
(N, K) = MI()
A = LI()
print((N - 1 + K - 2) // (K - 1))


import math
(n, k) = map(int, input().split())
A = list(map(int, input().split()))
A_min = min(A)
N = n - len([i for i in A if i == A_min])
print(math.ceil(N / (k - 1)))


(n, k) = list(map(int, input().split()))
A = list(map(int, input().split()))
key = 2 * k - 2
if key > n:
	if k == n:
		ans = 1
	else:
		ans = 2
elif n % key == 0:
	ans = 2 * (n // key)
elif n % key == 1:
	ans = 2 * (n // key)
elif n % key + 1 > k:
	ans = 2 * (n // key) + 2
else:
	ans = 2 * (n // key) + 1
print(ans)


(N, K) = list(map(int, input().split()))
A = list(map(int, input().split()))
i = N
count = 0
if N == K:
	count = 1
else:
	while True:
		count += i // K
		i = i // K + i % K
		if i <= K:
			break
	count += 1
print(count)


import math
(N, K) = list(map(int, input().split()))
A = list(map(int, input().split()))
cn = 1
Z = N - K
cn = cn + math.ceil(Z / (K - 1))
print(cn)


import math

def lmi():
	return list(map(int, input().split()))

def main():
	(N, K) = lmi()
	A = lmi()
	one_idx = A.index(1)
	L = one_idx
	R = N - one_idx - 1
	ans = L // (K - 1) + R // (K - 1)
	ans += math.ceil((L % (K - 1) + R % (K - 1)) / (K - 1))
	print(ans)

def __starting_point():
	main()
__starting_point()


import sys
pin = sys.stdin.readline

def main():
	(N, K) = map(int, pin().split())
	A = list(map(int, pin().split()))
	print((N - 2) // (K - 1) + 1)
	return
main()


3
import sys
(N, K) = (int(x) for x in input().split())
A = [int(x) for x in input().split()]
if N <= K:
	print(1)
	return
N -= K
ret = 1
ret += N // (K - 1)
if N % (K - 1) != 0:
	ret += 1
print(ret)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inps():
	return input().rstrip()

def inpl():
	return list(map(int, input().split()))

def inpls():
	return list(map(str, input().split()))
from math import gcd, floor, ceil, factorial
import itertools as it
from collections import deque, defaultdict
from collections import Counter

def lcd(a, b):
	return a * b // gcd(a, b)

def chmin(dp, i, x):
	if x < dp[i]:
		dp[i] = x
		return True
	return False

def chmax(dp, i, x):
	if x > dp[i]:
		dp[i] = x
		return True
	return False
(N, K) = inpl()
A = inpl()
if N == K:
	print(1)
	return
idx = 0
for i in range(N):
	if A[i] == 1:
		idx = i
		break
left = N - i
right = N - left - 1
start = max(0, K - 1 - right)
end = max(K - 1, left)
ans = 10 ** 10
for i in range(start, end + 1):
	l = left - i
	r = right - (K - 1 - i)
	if l == 0:
		l = 0
	else:
		l = (l - 0.5) // (K - 1) + 1
	if r == 0:
		r = 0
	else:
		r = (r - 0.5) // (K - 1) + 1
	ans = min(ans, int(l + r + 1))
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
for i in range(10 ** 5):
	if (k - 1) * i + 1 >= n:
		break
print(i)


from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, datetime

def inpl():
	return list(map(int, input().split()))

def inpl_s():
	return list(input().split())
(N, K) = map(int, input().split())
A = inpl()
N -= 1
K -= 1
print((N + K - 1) // K)


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

def __starting_point():
	main()
__starting_point()


import os
import sys

def main():
	(N, K) = list(map(int, input().split()))
	A = list(map(int, input().split()))
	A_min = min(A)
	cnt = 0
	for i in range(0, N - 1, K - 1):
		cnt += 1
	print(cnt)

def __starting_point():
	main()
__starting_point()


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


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
count = 0
count_list = []
for _ in x:
	count += 1
	if _ == 1:
		break
for _ in range(k):
	count_list.append((count - 1 - _ - 0.1) // (k - 1) + (n - count + _ - 0.1) // (k - 1) + 2)
print(int(min(count_list)))


(n, k) = list(map(int, input().rstrip().split(' ')))
A = list(map(int, input().rstrip().split(' ')))
minValue = 100000
minIndex = -1
for i in range(n):
	if minValue > A[i]:
		minValue = A[i]
		minIndex = i
ans = (n - 2) // (k - 1) + 1
print(ans)


(N, K) = map(int, input().split())
a = list(map(int, input().split()))
mn = min(a)
count_mn = a.count(mn)
ans = 0
for i in range(count_mn):
	N -= K
	ans += 1
	if N < 0:
		break
K -= 1
if N > 0:
	ans += N // K if N % K == 0 else N // K + 1
print(ans)


(n, k) = list(map(int, input().split()))
_ = input()
l = n - k
x = (l + (k - 1 - 1)) // (k - 1)
print(x + 1)


import math
(n, k) = list(map(int, input().strip().split(' ')))
window = k - 1
res = math.ceil((n - 1) / window)
print(res)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
m = min(a)
t = a.count(m)
h = n - t
print(h // (k - 1) + 1 - int(h % (k - 1) == 0))


import sys
sys.setrecursionlimit(10 ** 6)

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LC():
	return list(input())

def IC():
	return [int(c) for c in input()]

def MI():
	return map(int, input().split())

def solve():
	(N, K) = MI()
	A = LI()
	One = A.index(1)
	from math import ceil, floor
	if N == K:
		print(1)
		return
	else:
		print(ceil((N - K) / (K - 1)) + 1)
	return
solve()