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: interview

Starter code:

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 bisect import bisect_left, bisect_right
# from heapq import heapify, heappop, heappush
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
# import numpy as np    # cumsum

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)

# 入力値が1~Nの整数である前提があって成り立つ
# ↓は公式の解答例的なの
n, k = map(int, input().split());print((n-1+k-2)//(k-1))

from sys import stdin, stdout # only need for big input
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()

# 問題制約見間違えて1~Nの任意の数字をとると勘違いして作ったコード(一応通る)
# 4 2
# 1 2 1 2
# ↑のケースは存在しないパターンだが、所謂解答例の場合3となるがこのコードだと2となる
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())
print((n-2)//(k-1)+1)

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())) 
#cnt=A.index(1)+1
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())
a=input()
print((n-2)//(k-1)+1)

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

n = n-k
if n%(k-1) == 0:
    print(n//(k-1)+1)
else:
    print(n//(k-1)+2)

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)

# coding: utf-8
# Your code here!
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))

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

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-10-03 20:30:05 +0900
# LastModified: 2020-10-03 20:50:25 +0900
#


import os
import sys
import numpy as np
# import pandas as pd


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 math


n, k = map(int, input().split())
numbers = list(map(int, input().split()))
# len_nums = len(numbers)
# min_index = numbers.index(1) + 1
# if min_index % (k - 1) == 0 or min_index == 1:
#     before_time = min_index // (k - 1)
# else:
#     before_time = min_index // (k - 1) + 1

# if (len_nums - min_index) % (k - 1) == 0:
#     after_time = (len_nums - min_index) // (k - 1)
# else:
#     after_time = (len_nums - min_index) // (k - 1)
# print(before_time + after_time)
print(math.ceil((n - 1) / (k - 1)))

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
# input = sys.stdin.readline
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)


import math
N, K = map(int, input().split())
A = list(map(int, input().split()))

print(math.ceil((N-1)/(K-1)))

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


# coding: utf-8


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()

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

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 = map(int,input().split())
Ai = list(map(int,input().split()))
#a = Ai.index(1)

print(math.ceil((n-k) / (k-1) + 1))

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

print(int(math.ceil((N-1)/(K-1))))

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




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=list(map(int, input().split()))
A=list(map(int, input().split()))
print((N+K-3)//(K-1))

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

# coding:UTF-8
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 = map(int,input().split())
a = list(map(int,input().split()))
cnt, ttl = 1, k
while ttl < n:
  ttl += k - 1
  cnt += 1
print(cnt)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-10-03 20:30:05 +0900
# LastModified: 2020-10-24 19:05:05 +0900
#


import os
import sys
import numpy as np
# import pandas as pd


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(A)

    print(cnt)


def __starting_point():
    main()

__starting_point()

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)
else:
    if (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)

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 bisect import bisect_left, bisect_right
# from heapq import heapify, heappop, heappush
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
# import numpy as np    # cumsum

def solve():
    N, K = MI()
    A = LI()

    print((ceil((N-1) / (K-1))))


def __starting_point():
    solve()


__starting_point()

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)

else:
    if 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)


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


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)


# coding: utf-8
# Your code here!

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
# coding: utf-8

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
# sys.setrecursionlimit(10**6)

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()))

# import decimal
# from decimal import Decimal
# decimal.getcontext().prec = 10

# from heapq import heappush, heappop, heapify
# import math
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()

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C_fix
# CreatedDate:  2020-12-29 11:19:58 +0900
# LastModified: 2020-12-29 11:33:43 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


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())
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=map(int,input().split())
a=list(map(int,input().split()))
print((n-1)//(k-1) if (n-1)%(k-1)==0 else (n-1)//(k-1)+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().split()))
ans=(n-1)//(k-1)
if (n-1)%(k-1)==0:
  print(ans)
else:
  print((ans+1))


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

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

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

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)


# 34
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)))


#https://qiita.com/goto_yuta_/items/1c104e332351ab9389a6
# 入力を整数に変換して受け取る
import sys
sys.setrecursionlimit(10 ** 6)#pypy3はnumpyを使えない，この行を消すこと．
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力の文字列を1文字ずつに分けたものの配列を受け取る
def LC(): return list(input())
# 入力の数字列を1桁ずつに分けたものの配列を受け取る
def IC():return [int(c) for c in input()]
#少ない1行のint変数に入れる様の入力．例:N, A, B = map(int, input().split())
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()

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