Problem:
 Score : 300 points    Problem Statement 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 1 4 3
2 3 1 4      Sample Output 1 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 .         Sample Input 2 3 3
1 2 3      Sample Output 2 1       Sample Input 3 8 3
7 3 1 8 4 6 2 5      Sample Output 3 4

Solution (Python):



import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,k=MI()
lis=LI()
for i in range(n):
    if lis[i]==1:
        one=i+1

ans=ceil((n-1)/(k-1))
print(ans)

Solution (Python):
n, k = map(int, input().split())
s = input()
i = s.find("1")/2
ans = 0


while ans * (k-1) < i:
    ans += 1
i = max(i, ans * (k-1))


tmp = 0
while tmp * (k-1) + i < n-1:
    tmp += 1

print(ans + tmp)

Solution (Python):
from math import ceil
n, k = [int(x) for x in input().split()]
a_list = [int(x) for x in input().split()]
print(ceil((n - 1) / (k - 1)))

Solution (Python):
import math

N, K = map(int, input().split(' '))

n = max(0, N - K)
print(1 + math.ceil(n / (K - 1)))

Solution (Python):
import math
N, K = map(int, input().split())

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

Solution (Python):
import math

N,K = (int(x) for x in input().split())
A = list(map(int, input().split()))
if N == K:
    print('1')
else:
    print(math.ceil((N-1)/(K-1)))

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

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

print((n+k-3)//(k-1))

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

Solution (Python):
from math import ceil

N, K = map(int, input().split())
ll = list(map(int, input().split()))

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

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7
MAX = 10**18
MIN = -10**18

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

Solution (Python):
n, k = map(int, input().split())
print((n + k - 3) // (k - 1))

Solution (Python):
import math
n, k = map(int,input().split())
a = list(map(int,input().split()))

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

Solution (Python):
n,k=map(int,input().split())
print((n+k-3)//(k-1))

Solution (Python):
import math

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

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

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

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

Solution (Python):
from math import ceil
N, K = map(int, input().split())
print(ceil((N - 1) / (K - 1)))

Solution (Python):
from math import ceil

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

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

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

Solution (Python):
import math

N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0

least_g = (N-1) / (K-1)

if least_g.is_integer():
    print(int(least_g))
else:
    print(int(least_g)+1)

Solution (Python):
input_line = input().split()

num_array = int(input_line[0])
num_equal = int(input_line[1])

input_line = input() 

equalized = 1
i = 0
while equalized < num_array:
    equalized += (num_equal - 1)
    
    i += 1

print(str(i))

Solution (Python):
def resolve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    print(-(-(n-1)//(k-1)))

resolve()

Solution (Python):
def main():
  n, k = map(int, input().split())
  m = 1 + (n - k) // (k - 1)
  if (n - k) % (k - 1) == 0:
    print(m)
  else:
    print(m + 1)
if __name__=="__main__":
  main()

Solution (Python):
def main():
  n, k = map(int, input().split())
  if (n - k) % (k - 1):
    print(1 + (n - k) // (k - 1) + 1)
  else:
    print(1 + (n - k) // (k - 1) )
if __name__=="__main__":
  main()

Solution (Python):
def main():
  n, k = map(int, input().split())
  if (n - k) % (k - 1) == 0:
    print(1 + (n - k) // (k - 1))
  else:
    print(1 + (n - k) // (k - 1) + 1)
if __name__=="__main__":
  main()

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

Solution (Python):
n, k = map(int, input().split());print(1 + (n - k) // (k - 1) + ((n - k) % (k - 1) != 0))

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


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n, k, *a = map(int, open(0).read().split())
    ans = 1 + (n - k) // (k - 1) + ((n - k) % (k - 1) != 0)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    from math import ceil
    n, k, *a = map(int, open(0).read().split())
    ans = 1 + ceil((n - k) / (k - 1))
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    from math import ceil
    n, k, *a = map(int, open(0).read().split())
    i = a.index(1)
    ans = 1 + ceil((n - k) / (k - 1))
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import math
n,k=map(int,input().split())
A=list(map(int,input().split()))
if n==k:
    print(1)
else:
    n-=k
    print(1+math.ceil(n/(k-1)))

Solution (Python):


import sys
import math





















def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n, k = mi()
    L = lmi()
    L.sort()
    minimum = L[0]
    cnt = 0
    for i in range(n):
        if L[i] == minimum:
            cnt += 1
    print(math.ceil((n - cnt) / (k - 1)))


if __name__ == "__main__":
    main()

Solution (Python):
n,k = map(int,input().split())
print((n+k-3) // (k-1))

Solution (Python):
n,k = map(int,input().split())
a = list(map(int,input().split()))
i = 1
while  n > k + (k-1)*(i-1):
    i += 1

print(i)

Solution (Python):
import math

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

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

Solution (Python):
N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

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

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

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

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

t=k
ans=1
while t < n:
  t+=k-1
  ans+=1
print(ans)

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

Solution (Python):
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
print(1 if n <= k else 1 + -(-(n - k) // (k - 1)))

Solution (Python):
import math
N, K = map(int,input().split())
list_ai = map(int,input().split())
print(math.ceil(1+(N-K)/(K-1)))

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

Solution (Python):





def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    ans = 1
    N -= K
    if N % (K-1) == 0:
        ans += N // (K-1)
    else:
        ans += N // (K-1) + 1
    
    return ans


print(main())

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

Solution (Python):
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
A_min = min(A)
index = A.index(A_min)
ans = 0
left = index
right = N - 1 - index
if left % (K - 1) != 0:
    right -= K - 1 - left % (K - 1)
elif right % (K - 1) != 0:
    left -= K - 1 - right % (K - 1)
ans += math.ceil(left / (K - 1))
ans += math.ceil(right / (K - 1))   
print(ans)

Solution (Python):

n, k = map(float, input().split())
ans = -(-(n-1) // (k-1))
print(int(ans))

Solution (Python):

n, k = map(int, input().split())
print(0--~-n//~-k)

Solution (Python):
from sys import stdin
def main():
    
    readline=stdin.readline
    N,K=map(int,readline().split())
    a=list(map(int,readline().split()))

    m=N-1
    l=K-1
    print((m+l-1)//l)
if __name__=="__main__":
    main()

Solution (Python):
n,k=map(int,input().split())
A = list(map(int,input().split()))
n -= k
k -= 1
ans = 1
ans += (n+k-1)//k
print(ans)

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

ans = 1
n -= k
k -= 1

if n % k == 0:
    ans += n // k
else:
    ans += n // k + 1

print(ans)

Solution (Python):
import math
n, k = map(int, input().split())
a = [int(i) for i in input().split()]


print(int(math.ceil((len(a)-1) / ( k -1))))

Solution (Python):
N, K = map(int, input().split())
A = list(map(int, input().split()))

def solve(N,K,A):
    ans = -(-(N-1)//(K-1))
    return ans
print(solve(N,K,A))

Solution (Python):
import math
def main():
    N, K = map(int, input().split())
    A = [int(a) for a in input().split()]

    if N == 1:
        print(0)
    elif N <= K:
        print(1)
    else:
        print(1+math.ceil((N-K)/(K-1)))

if __name__ == "__main__":
    main()

Solution (Python):

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

print((n-2)//(k-1)+1)

Solution (Python):
import sys
import math

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

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

Solution (Python):
import math

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


answer = math.ceil((N - 1)/ (K - 1))

print(answer)

Solution (Python):
n, k = map(int, input().split())
lst = list(map(int, input().split()))

n -= 1
k -= 1
  
print(-(-n // k))

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=1
n=n-k
while(n>0):
    n=n-(k-1)
    count+=1
print(count)

Solution (Python):
n, k = map(int, input().split())

A = list(map(int, input().split()))


min_a = A.index(min(A))

left = min_a
right = n - min_a - 1


min_ = min(left, right)
max_ = max(left, right)


t = 0
min_ = min_ - k
t +=1
temp = 0
if min_ > 0:
    if min_ % (k - 1) != 0:
        temp = min_ // (k - 1)
    else:
        temp = min_ // (k - 1) + 1
    min_ -= temp * (k - 1)
t += temp

max_ = max_ + min_ + 1

if max_ % (k - 1) == 0:
    t += max_ // (k - 1)
else:
    t += max_ // (k - 1) + 1

print(t)

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

Solution (Python):
N, K = map(int, input().split())
print((N-2)//(K-1)+1)

Solution (Python):
x, y = map(int,input().split())
li = list(map(int,input().split()))

if (x-1)%(y-1) == 0:
    print((x-1)//(y-1))
else:
    print((x-1)//(y-1)+1)

Solution (Python):

import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, K: int, A: "List[int]"):
    m = min(A)
    m1 = A.index(m)
    ans = -(-m1 // (K - 1))
    c = ans * (K - 1) + 1
    while c < N:
        while A[c] == m:
            c += 1
        c += K - 1
        ans += 1
    print(ans)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N)]  
    solve(N, K, A)


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np
n, k = map(int, input().split())
print(-(-(n-1)//(k-1)))

Solution (Python):
import sys
readline = sys.stdin.readline
import math

def main():
    N, K = map(int, readline().rstrip().split())
    A = list(map(int, readline().rstrip().split()))
    print(math.ceil((N-1)/(K-1)))


if __name__ == '__main__':
    main()

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

Solution (Python):
n, k = map(int, input().split())

q = (n-1) // (k-1)
r = (n-1) % (k-1)

if r: print(q+1)
else: print(q)

Solution (Python):
from math import ceil
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
n=n-k
c=1
if(n>0):
    c+=ceil(n/(k-1))
print(c)

Solution (Python):
n,k = map(int, input().split())
A = list(map(int, input().split()))
counter = 0

for i in range(0,n,k-1):
  min_n = min(A[i:i+k])
  max_n = max(A[i:i+k])
  if min_n != max_n:
    counter += 1
  if i+k-1 < n:
    A[i+k-1] = min_n
  
print(counter)

Solution (Python):
import math
n,k = map(int,input().split())
s = input()
print(math.ceil((n-1)/(k-1)))

Solution (Python):
import math
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
print(math.ceil((n - 1) / (k - 1)))

Solution (Python):
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort()
for i in range(1, N):
    if A[i] != A[0]:
        idx = i
        break

if (N - idx) % (K - 1) == 0:
    print(int((N - idx) / (K - 1)))
else:
    print(int((N - idx) / (K - 1)) + 1)

Solution (Python):
n,k=list(map(int, input().split()))
a= list(map(int, input().split()))
final=min(a)
ans=0
flag=-1
check=0
for v in a:
    if flag==-1 and v!=final:
        flag=2
        ans+=1
        check=0
        if flag==k:
            flag=-1
    elif flag>=0:
        if check==0 and v==final:
            flag-=1
            check=1
        flag+=1
        if flag==k:
            flag=-1
print(ans)

Solution (Python):
import math

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

ans = 0

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

Solution (Python):
n,k = map(int,input().split())
l = list(map(int,input().split()))

print(-(-(n-1)//(k-1)))

Solution (Python):
N,K=list(map(int, input().split()))
A=list(map(int, input().split()))
A.pop(1)
f=len(A)//(K-1)
if len(A)%(K-1)==0:
    print(f)
else:
    print(f+1)

Solution (Python):


nim,mike=map(int,input().split())

array=[int(x) for x in input().split()]

print((nim+mike-3)//(mike-1))

Solution (Python):
n, k = map(int, input().split())
As = list(map(int, input().split()))

idx = As.index(min(As))
left = idx

n_l = (left + k - 2) // (k - 1)

right = n - ((n_l) * (k-1)) - 1

n_r = (right + k - 2) // (k - 1)

print(n_l + n_r)

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

Solution (Python):

import sys

def main():
    N, K = map(int,input().split())
    a = list(map(int,input().split()))

    answer = 0
    for i in range(N):
        if K + (i-1)*(K-1) >= N:
            answer = i
            break

    print(answer)
    return

if __name__ == '__main__':
    main()

Solution (Python):
n,k = map(int,input().split())
l = list(map(int,input().split()))

print(-(-(n-1)//(k-1)))

Solution (Python):
N,K = map(int,input().split())
A = list(map(int,input().split()))

if (N-1)%(K-1) == 0:
    print((N-1)//(K-1))
else:
    print((N-1)//(K-1) + 1)

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

Solution (Python):
import math

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

ans = 0

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

Solution (Python):



import sys
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


N, K = read_ints()
if N == K:
    print(1)
    exit()
A = read_ints()

K -= 1
i = A.index(1)


ans = 0
for j in range(0, N - 1, K):
    ans += 1

print(ans)

Solution (Python):
n,k = map(int,input().split())
a_ls = list(map(int, input().split()))

stroke = k - 1
if k < n:
    rest = n - k
    ans = 1 + -(-rest // stroke)
else:
    ans = 1
print(ans)

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

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

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

Solution (Python):
import math
total = 0
N,M = list(map(int,input().split()))
M = M-1
n_l = "".join(input().split())
A = n_l.find("1")
before = A
after = N-A-1
while before > 0:
    before-=M
    total +=1
if before < 0:
    before = abs(before)
    after -= before
while after > 0:
    after-=M
    total +=1
print(total)

Solution (Python):
N, K = map(int, input().split())
A = list(map(int, input().split()))

g = 1

while N > K + (K - 1) * (g - 1):
    g += 1
print(g)

Solution (Python):
N, K = map(int, input().split())
A = list(map(int, input().split()))

cnt = 1
length = K
while True:
    if length >= N:
        print(cnt)
        break
    length += K-1 
    cnt += 1

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

Solution (Python):
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n, k = nm()
a = nl()

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

Solution (Python):
N,K = map(int, input().split())
A=list(map(int,input().split()))

min_num=min(A)
count=A.count(min_num)
target=len(A)-count
K_num=K-1

print(int(-(-target//K_num)))

Solution (Python):
import sys

n, k = map(int, sys.stdin.readline().split())

def main():
    print((n + k - 3) // (k - 1))

if __name__ ==  '__main__':
    main()

Solution (Python):




mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n,k = readInts()
    A = readInts()
    import math
    nokori = n - k
    
    cnt = 1
    cnt += math.ceil(nokori/(k-1))
    print(cnt)




if __name__ == '__main__':
  main()

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

Solution (Python):
n=input().rstrip().split()
preans=(int(n[0])-1)/(int(n[1])-1)
 
ans=int(preans)
if (int(n[0])-1)%(int(n[1])-1)!=0:
  ans+=1
print(ans)

Solution (Python):
N,K = map(int,input().split())
A = list(map(int,input().split()))
print((len(A)-1)//(K-1) + int(bool((len(A)-1)%(K-1))))

Solution (Python):
NK = list(map(int, input().split()))
no = list(map(int, input().split()))

zan = NK[0]
counter = 0
while(NK[1] < zan):
    zan -= NK[1] - 1
    counter += 1

print(counter + 1)

Solution (Python):
n,k = map(int,input().split())
count = 1
n = n-k

while 0<n:
  n = (n+1) - k
  count = count + 1
  
print(count)

Solution (Python):
N, K = map(int, input().split())
arr = list(map(int, input().split()))
print(-(-(N-1)//(K-1)))

Solution (Python):
n, k = map(int, input().split())
A = list(map(int, input().split()))

ans = (n-1) // (k-1)
if (n-1) % (k-1) > 0: ans += 1
print(ans)

Solution (Python):
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
x=a.index(1)
print(math.ceil((n-1)/(k-1)))

Solution (Python):
import math
n,k = map(int,input().split())
s = input()
print(math.ceil((n-1)/(k-1)))

Solution (Python):

from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce

from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import statistics
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
def lcm(a, b):
  return a*b//gcd(a, b)

def main():
  N, K = map(int, readline().split())
  A = list(map(int, readline().split()))
  print(ceil((N-1)/(K-1)))
  
  
  
  
  
if __name__ == '__main__':
  main()

Solution (Python):
mod = 10 ** 9 + 7
mod2 = 2 ** 61 + 1
from collections import deque
import heapq
from bisect import bisect_left, insort_left, bisect_right

_NUMINT_ALL = list(range(10))


def main():
    ans = solve()

    if ans is True or ans is False:
        YesNo(ans)
    elif ans is not None:
        print(ans)




def solve():
    N, K = iip(False)
    A = iip(False)

    if N == 1:
        return 0
    if N <= K:
        return 1

    return -(-(N-1) // (K-1))




def iip(listed=True, num_only=True):  
    if num_only:
        ret = [int(i) for i in input().split()]
    else:
        ret = [int(i) if i in _NUMINT_ALL else i for i in input().split()]

    if len(ret) == 1 and not listed:
        return ret[0]
    return ret


def saidai_kouyakusuu(A):  
    l = len(A)
    while True:
        m = min(A)
        mx = max(A)
        if m == mx:
            return m

        for i in range(l):
            if A[i] % m == 0:
                A[i] = m
            else:
                A[i] %= m


def make_graph_edge_flat(N):  
    ret = []
    for i in range(N-1):
        a, b, c = iip()
        a -= 1
        b -= 1
        ret[a].append((b, c))
        ret[b].append((a, c))
    return ret


def sort_tuples(l, index):  
    if isinstance(l, list):
        l.sort(key=lambda x: x[index])
        return l
    else:
        l = list(l)
        return sorted(l, key=lambda x: x[index])


def count_elements(l):  
    d = {}
    for i in l:
        if i in d:
            d[i] += 1
        else:
            d[i] = 1
    return d


def safeget(l, index, default="exception"):  
    if index >= len(l):                      
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。配列の長さは", len(l), "です"]))
        else:
            return default
    elif index < 0:
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。負の値は許可されていません"]))
        else:
            return default
    else:
        return l[index]


def iipt(l, listed=False, num_only=True):  
    ret = []
    for i in range(l):
        ret.append(iip(listed=listed, num_only=num_only))
    return ret


def sortstr(s):  
    return "".join(sorted(s))


def iip_ord(startcode="a"):  
    if isinstance(startcode, str):
        startcode = ord(startcode)
    return [ord(i) - startcode for i in input()]


def YesNo(s):  
    if s:
        print("Yes")
    else:
        print("No")


def fprint(s):  
    for i in s:
        print(i)


def bitall(N):  
    ret = []
    for i in range(2 ** N):
        a = []
        for j in range(N):
            a.append(i % 2)
            i //= 2
        ret.append(a)
    return ret

def split_print_space(s):  
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):  
    print("\n".join([str(i) for i in s]))


def soinsuu_bunkai(n):  
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):  
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        
        pass
    return ret


def inv(n, mod):  
    return power(n, mod - 2)


def power(n, p, mod_=mod):  
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


def nibutan_func(func, target, left, right, side="left"): 
    l = left
    r = right
    while r-l > 1:
        x = (l+r)//2
        if func(x) == target:
            return x
        elif func(x) > target:
            r = x
        else:
            l = x

    if side == "left" or func(x) == target:
        return l
    else:
        return r


def nibutan_list(list_, target, side="left"):  
    if not isinstance(list_, list):
        list_ = list(list_)

    l = 0
    r = len(list_)
    while r-l > 1:
        x = (l+r)//2
        if list_[x] == target:
            return x
        elif list_[x] > target:
            r = x
        else:
            l = x

    if side == "left" or list_[x] == target:
        return l
    else:
        return r

if __name__ == "__main__":
    main()

Solution (Python):
mod = 10 ** 9 + 7
mod2 = 2 ** 61 + 1
from collections import deque
import heapq
from bisect import bisect_left, insort_left, bisect_right

_NUMINT_ALL = list(range(10))


def main():
    ans = solve()

    if ans is True or ans is False:
        YesNo(ans)
    elif ans is not None:
        print(ans)




def solve():
    N, K = iip(False)
    A = iip(False)

    if N == 1:
        return 0
    if N <= K:
        return 1
    if (N-1) % (K-1) == 0:
        return (N-1) // (K-1)
    else:
        return (N-1) // (K-1) + 1




def iip(listed=True, num_only=True):  
    if num_only:
        ret = [int(i) for i in input().split()]
    else:
        ret = [int(i) if i in _NUMINT_ALL else i for i in input().split()]

    if len(ret) == 1 and not listed:
        return ret[0]
    return ret


def saidai_kouyakusuu(A):  
    l = len(A)
    while True:
        m = min(A)
        mx = max(A)
        if m == mx:
            return m

        for i in range(l):
            if A[i] % m == 0:
                A[i] = m
            else:
                A[i] %= m


def make_graph_edge_flat(N):  
    ret = []
    for i in range(N-1):
        a, b, c = iip()
        a -= 1
        b -= 1
        ret[a].append((b, c))
        ret[b].append((a, c))
    return ret


def sort_tuples(l, index):  
    if isinstance(l, list):
        l.sort(key=lambda x: x[index])
        return l
    else:
        l = list(l)
        return sorted(l, key=lambda x: x[index])


def count_elements(l):  
    d = {}
    for i in l:
        if i in d:
            d[i] += 1
        else:
            d[i] = 1
    return d


def safeget(l, index, default="exception"):  
    if index >= len(l):                      
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。配列の長さは", len(l), "です"]))
        else:
            return default
    elif index < 0:
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。負の値は許可されていません"]))
        else:
            return default
    else:
        return l[index]


def iipt(l, listed=False, num_only=True):  
    ret = []
    for i in range(l):
        ret.append(iip(listed=listed, num_only=num_only))
    return ret


def sortstr(s):  
    return "".join(sorted(s))


def iip_ord(startcode="a"):  
    if isinstance(startcode, str):
        startcode = ord(startcode)
    return [ord(i) - startcode for i in input()]


def YesNo(s):  
    if s:
        print("Yes")
    else:
        print("No")


def fprint(s):  
    for i in s:
        print(i)


def bitall(N):  
    ret = []
    for i in range(2 ** N):
        a = []
        for j in range(N):
            a.append(i % 2)
            i //= 2
        ret.append(a)
    return ret

def split_print_space(s):  
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):  
    print("\n".join([str(i) for i in s]))


def soinsuu_bunkai(n):  
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):  
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        
        pass
    return ret


def inv(n, mod):  
    return power(n, mod - 2)


def power(n, p, mod_=mod):  
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


def nibutan_func(func, target, left, right, side="left"): 
    l = left
    r = right
    while r-l > 1:
        x = (l+r)//2
        if func(x) == target:
            return x
        elif func(x) > target:
            r = x
        else:
            l = x

    if side == "left" or func(x) == target:
        return l
    else:
        return r


def nibutan_list(list_, target, side="left"):  
    if not isinstance(list_, list):
        list_ = list(list_)

    l = 0
    r = len(list_)
    while r-l > 1:
        x = (l+r)//2
        if list_[x] == target:
            return x
        elif list_[x] > target:
            r = x
        else:
            l = x

    if side == "left" or list_[x] == target:
        return l
    else:
        return r

if __name__ == "__main__":
    main()

Solution (Python):
n,k = map(int,input().split())
a_L = list(map(int,input().split()))

ans = 1
n = n-k

while True:
    if n<=0:
        print(ans)
        exit()
    n = n-k+1
    ans += 1