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):
N, K = map(int, input().split())
A = list(map(int, input().split()))

A_len = len(A)
A_len -= K
if A_len <= 0:
    print(1)
else:
    if A_len % (K-1) == 0:
        print(A_len // (K-1) + 1)
    else:
        print(A_len // (K-1) + 2)

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

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

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

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

Solution (Python):



import sys













def main():
    n, k, *a = (int(x) for x in sys.stdin.read().split())
    i = a.index(1)
    l = k - 1
    left, right = i, (n - 1) - i
    if left % l == 0:
        if right % l == 0:
            ans = left // l + right // l
        else:
            ans = left // l + right // l + 1
    else:
        if right % l  == 0:
            ans = left // l + 1 + right // l 
        else:
            if left % l + right % l > l:
                ans = left // l + right // l + 2
            else:
                ans = left // l + right // l + 1 
    
    print(ans)




if __name__ == "__main__":
    
    main()

Solution (Python):

N, K = list(map(lambda x: int(x), input().split(' ')))
input()

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

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

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

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

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()))
ind = A.index(1)
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 = [int(a) for a in input().split()]
m = min(A)
ans = 0
i = 0
while i < N:
    if A[i] == m:
        i += 1
    else:
        ans += 1
        if min(A[i:i+K]) == m:
            i += K
        else:
            i += K - 1
print(ans)

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

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,k = inpl()
a = inpl()
print(-(-(n-1)//(k-1)))

Solution (Python):
def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

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

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

if __name__ == '__main__':
    main()

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):
import numpy as np
import statistics

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

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

Solution (Python):
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
ind=l.index(min(l))
left=ind
right=n-ind-1 
from math import ceil 
print(ceil((left+right)/(k-1)))

Solution (Python):
N,K=map(int,input().split())
n=K
num=1
while not n>=N:
  n+=K-1
  num+=1
print(num)

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

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

Solution (Python):
def main():

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

    id1 = a.index(1)

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

print(main())

Solution (Python):

if __name__ == '__main__':

	N = list(map(int,input().split()))
	input()
	n = N[0]
	m = N[1]

	cnt = 0
	while True:
		if m >= n:
			cnt += 1
			break
		n = n - m + 1
		cnt += 1

	print(cnt)

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

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

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
k-=1
for i in range(n):
    if a[i]==1:
        l=i+1
        break
n-=k+1
if n%k==0:
    print(n//k+1)
else:
    print(n//k+2)

Solution (Python):
N,K = map(int,input().split())
cnt = 1
while N > K + (K-1)*(cnt-1):
  cnt += 1
print(cnt)

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

import numpy as np 
ans = np.ceil((N-1)/(K-1))
print(int(ans))

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

ans=((N-1)+(K-2))//(K-1)

print(ans)

Solution (Python):
n,k = map(int,input().split())
S = list(map(int,input().split()))
res = k
ans = 1
while res < n:
    res += k-1
    ans += 1
print(ans)

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



ans = None
if n == k:
    ans = 1
else:
    if (n - 1) % (k - 1) != 0:
        ans = (n - 1) // (k - 1) + 1
    else:
        ans = (n - 1) // (k - 1)

print(ans)

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

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

total = 0
init = 1
cnt = 0
while total < N:
	if init == 1:
		total += K
	else:
		total += K - 1
	init = 0
	cnt += 1
	
print(cnt)

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

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

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

print(ans)

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

Solution (Python):
N,M=map(int,input().split())

M-=1
N-=1
x=N//M
if N%M!=0:
  x+=1
print(x)

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,K = map(int,readline().split())

answer = (N-1+K-2) // (K-1)
print(answer)

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

Solution (Python):
import math

N,K=map(int,input().split())
A=[int(i) for i in input().split()]

goal=min(A)
num=A.count(goal)

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

Solution (Python):
import math

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

if N == K:
  print("1")
else:
  x = (N - K) / (K - 1)
  ans = math.ceil(x) + 1
  print(ans)

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

if((len(hoge)-1)/(k-1)%1==0):
  print((len(hoge)-1)//(k-1))
else:
  print(1+(len(hoge)-1)//(k-1))

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

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










ans = (N + K - 3) // (K - 1)
print(ans)

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

Solution (Python):
n,k = map(int, input().split())
a = list(map(int, input().split()))
point = 0
for i in range(n):
    if a[i]==1:
        point=i+1
x = point-1
xa = x%(k-1)
x = (-x)//(k-1)
x = -x
y = n-point
ya = y%(k-1)
y = (-y)//(k-1)
y = -y
ans = x+y
if xa>0 and ya>0 and xa+ya<k:
    ans-=1
print(ans)

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())
import math
A=[]*n
A[:]=map(int,input().split())
A=sorted(A)
if n==k:
  print(1)
else:
  print(1+int(math.ceil((n-k)/(k-1))))

Solution (Python):

import sys
sys_input = sys.stdin.readline

N, K = map(int, sys_input().split())
AAA = list(map(int, sys_input().split()))

if N == K:
    print(1)
    exit()

n_remain = N
n_calc = 0
while n_remain > 0:
    n_remain += (-K+1)
    n_calc += 1
    if n_remain == K:
        n_calc += 1
        break

print(n_calc)

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

A_min_idx = A.index(min(A))

print(-(-(len(A)-1) // (k-1)) )

Solution (Python):
import sys
from math import ceil
inputs = sys.stdin.readlines()

n, k = map(int, inputs[0].split())
A = list(map(int, inputs[1].split()))

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

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

ind = A.index(1)
ans = 0
if ind == 0 or ind == N - 1:
    ans = math.ceil((N - 1) / (K -1))
else:
    
    ans += math.ceil((ind) / (K - 1))
    tmp = ind % (K - 1)
    
    if tmp == 0:
        ans += math.ceil((N - ind - 1) / (K - 1))
    else:
        ans += math.ceil((N - ind - 1 - K +  1 + tmp) / (K - 1))

print(ans)

Solution (Python):


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

def inv(a,K,A):
    count=0
    count+=-(-a//(K-1))
    a=(K-1)*count
    count+=-(-(len(A)-1-a)//(K-1))
    return count


print(min(inv(a,K,A),inv(a,K,A[::-1])))

Solution (Python):
import math

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


index_1 = A.index(1)


if K <= index_1 <= (N-1) - (K-1) -1:
    
    tmp = []
    for i in range(K):
        len_rest_left = index_1 - i
        len_rest_right = N - len_rest_left - K
        tmp.append(math.ceil(len_rest_left/(K-1)) + math.ceil(len_rest_right/(K-1)))
    ans = min(tmp) + 1
else:
    ans = math.ceil((N-1)/(K-1))
    
print(ans)

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

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

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

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

if __name__ == '__main__':
    print(solve())

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

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

Solution (Python):
def solve():
    n,k = map(int, input().split())
    A = map(int, input().split())
    if (n-1)%(k-1) != 0:
        return (n-1)//(k-1) + 1
    else:
        return (n-1)//(k-1)

if __name__ == '__main__':
    print(solve())

Solution (Python):
n,k = map(int,input().split())
A = list(map(int,input().split()))
one = A.index(1) +1
ans = float('inf')

for i in range(k):
    left = max(0,one-i)
    right = min(n,one+k-1 - i)
    num_l = max(0,int((left-1-0.1)//(k-1))+1)
    num_r = max(0,int((n - right-0.1)//(k-1))+1)
    ans = min(ans,num_r+num_l)

print(ans+1)

Solution (Python):
def test():
    m = 0
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    b = (n-1)/(k-1)
    while(m<b):
        m += 1
    print(m)


if __name__ == "__main__":
    test()

Solution (Python):
import math

n, k = map(int, input().split())
a = 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()))

if len(A_list) <= K:
    print("1") 
elif len(A_list)%(K-1)==1:
    print(math.ceil(len(A_list)/(K-1))-1) 
elif K==2:
    print(len(A_list)-1)
else:
    print(math.ceil(len(A_list)/(K-1)))

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

Solution (Python):
import math

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

if N == K:
    print(1)
    exit()

print(math.ceil((N-1)/(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()))
if N <= K:
  print(1)
else:
  print(math.ceil((N - K) / (K - 1)) + 1)

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



T = (N-2) // (K-1)+1
print(T)

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


T = (N-2) // (K-1)+1
print(T)

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())
A = list(map(int, input().split()))

minA = A.index(min(A))
ans = N

for i in range(K):
  count = 1
  left = minA - i
  right = minA + K - 1 - i
  
  if left >= 0:
    count += left // (K - 1)
    if left % (K - 1) != 0:
      count += 1
  if right != N -1:
    count += (N - right - 1) // (K - 1)
    if (N - right + 1) % (K - 1) != 0:
      count += 1
  if (left >= 0) and (right < N):
    ans = min(count, ans)
  
print(ans)

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+k-3)//(k-1))

Solution (Python):
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)

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

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

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,*a = map(int, open(0).read().split())
print((n+k-3)//(k-1))

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

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

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

Solution (Python):
from math import ceil

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

print(1 + ceil((N-K)/(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

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

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

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

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

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

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

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

Solution (Python):
n,k=[int(i)-1 for i in input().split()];print(-(-n//k))

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

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

Solution (Python):
def main():
    N, K = (int(i) for i in input().split())
    from math import ceil
    print(ceil((N-1)/(K-1)))
if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N, K = (int(i) for i in input().split())
    A = (int(i) for i in input().split())
    from math import ceil
    print(ceil((N-1)/(K-1)))
if __name__ == '__main__':
    main()

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

while N>0:
    N-=(K-1)
    flag+=1
    if N==1:
        break;
print(flag)

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

ans = ((N - 1) + ((K - 1) - 1)) // (K - 1)
print(ans)

Solution (Python):
N,K= [int(x) for x in input().split()]
print(1+(N-2)//(K-1))

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


print((len(A)-1+K-2)//(K-1))

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

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

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

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, k = LI()
a = LI()
print((n - 1) // (k - 1) + bool((n - 1) % (k - 1)))

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

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

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

Solution (Python):
import math

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

min_a = min(A)
min_a = A.count(min_a)
calc = N - min_a

K -= 1
print(math.ceil(calc/K))

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

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

Solution (Python):

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


from math import ceil

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




idx = A.index(1)


left = ceil(idx / (K-1))
remain = (K-1)*(left-1)+K


right = ceil((N-remain) / (K-1))

print(left+right)

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

Solution (Python):
n, k = [int(x) for x in input().split()]
print((n - 2) // (k - 1) + 1)

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

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

Solution (Python):

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

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

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

Solution (Python):
import math

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

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

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

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

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

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

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

Solution (Python):
n,k = map(int,input().split())
A = list(map(int,input().split()))
a = A.index(1)
b = -(-a//(k-1))*(k-1)
if n == k:
    print(1)
else:
    print(-(-a//(k-1))-(-(n-b-1)//(k-1)))

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

tmp = a.index(min(a))
amri = ((tmp) % (K - 1))
if amri == 0:
    ans = math.ceil(tmp / (K - 1)) + math.ceil((N - tmp - 1) / (K - 1))
else:
    ans = math.floor(tmp / (K - 1)) + math.ceil((N - tmp - (K- amri)) / (K - 1)) + 1
print(ans)

Solution (Python):
N,K=map(int,input().split())
c=1
while K+(c-1)*(K-1)<N:
  c+=1
print(c)

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

Solution (Python):




def main():

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

    if N == K : print(1); exit()
    cnt = 1
    rem = len(aList)
    rem -= K
    decrease = K-1

    while(rem > 0):
        rem -= decrease
        cnt += 1
    print(cnt)

 





if __name__ == "__main__":
    main()

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

Solution (Python):
N, K, *A = map(int, open(0).read().split())
print(-(-(N - 1) // (K - 1)))

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

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

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

min_index = A.index(min(A))

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

print(ans)

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

Solution (Python):


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

print((len(As) - 2) // (K-1) + 1)

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

if n==k:
    ans=1
else:
    ans = -(-(n-k)//(k-1))+1

print(ans)

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

Solution (Python):
import math

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

n = n - 1
k = k - 1

print(math.ceil(n/k))

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

A = list(map(int,input().split()))
one = 0
for i in range(len(A)):
    if A[i] == 1:
        one = i
        
zenhan = one - 0
kouhan = N-1 - one

if zenhan%(K-1) != 0:
    kouhan -= (K-1 - zenhan%(K-1))

print(-(-zenhan//(K-1)) - (-kouhan//(K-1)))

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

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

Solution (Python):
m,n = list(map(int, input().split()))
a = list(map(int, input().split()))
c = len(a)
d = (c-1)//(n-1)
e = (c-1)% (n-1)
print(d if e== 0 else (d+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())
A=list(map(int,input().split()))
r=n-A.index(1)-1
l=A.index(1)
print(min(-(-r//(k-1))-(-l//(k-1)),-(-(n-1)//(k-1))))

Solution (Python):
N,K=[int(s) for s in input().split()]
x=1
for i in range(1,N):
  x+=(K-1)
  if x>=N:
    print(i)
    break

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 - 1) // (k - 1) + 2)

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

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

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

rmn = n - k
ans = (rmn - 1) // (k - 1) + 2

print(ans)

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
S = list(map(int,input().split()))
N = S[0]
K = S[1]
print(math.ceil((N-1)/(K-1)))

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


r = (N-1 +(K-1)-1)//(K-1)
print(r)

Solution (Python):


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

min_x = min(a_list)
min_x_i_list = [i for i, a in enumerate(a_list) if a == min_x]

c = 0


start_x_i = min_x_i_list[0]

if start_x_i + 1 < K:
    index = K - 1
    c += 1
else:
    x = math.ceil(start_x_i / (K - 1))
    index = (K - 1) * x
    c += x

while index < N - 1:  
    
    next_min_list = [y for y in min_x_i_list if (index < y) and y <= (index + K)]
    if next_min_list:
        index += K
        c += 1
    else:
        index += K - 1
        c += 1

print(c)

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

    tmp = N - K
    tmp = tmp / (K-1)
    if tmp - int(tmp) != 0:
        ans = 2 + int(tmp)
    else:
        ans = 1 + int(tmp)
    print(ans)

if __name__ == "__main__":
    main()

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

if n == k:
    print (1)
elif k == 2:
    print(n-1)
else:
    print(-(-(n-1)//(k-1)))

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

if n == k:
  print(1)
elif k == 2:
  print(n - 1)
else:
  print(-(-(n - 1)//(k - 1)))

Solution (Python):
import sys
from collections import deque
from collections import  Counter
import statistics
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, k = na()
aaa = na()
ans = 1
n -= k
if n == 0:
    pass
elif n % (k - 1) == 0:
    ans += n // (k - 1)
else:
    ans += n // (k - 1) + 1
print(ans)

Solution (Python):
n,k=map(int,input().split())
box=[map(int,input().split())]
cost,point=1,0
n=n-k
while n>0:
    n -=k-1
    cost +=1
print(cost)

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

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

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

Solution (Python):
from math import ceil

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

ans = ceil((N-K)/(K-1) + 1)

print(ans)

Solution (Python):
import sys
import math
from fractions import gcd





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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N, K =  map(int, sys.stdin.readline().split())
L =  list(map(int, sys.stdin.readline().split()))

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

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

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

Solution (Python):
from sys import stdin
n, k, *a = map(int, stdin.read().split())
print(((n - 1) + (k - 2)) // (k - 1))

Solution (Python):

import sys
import math
from collections import defaultdict


sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]


mod = 10**9 + 7


def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))



N,K = II()
A = III()

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

Solution (Python):

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

one_index = None
for i in range(len(a_list)):
    if a_list[i] == 1:
        one_index = i
left_n = one_index
right_n = n - one_index - 1

delete_num = k - 1
minimum = None
for i in range(k):
    hidarihashi_index = one_index - i
    migihashi_index = one_index - i + k - 1
    if hidarihashi_index < 0:
        hidari_nokori = 0
    else:
        hidari_nokori = hidarihashi_index

    if migihashi_index > (n-1):
        migi_nokori = 0
    else:
        migi_nokori = (n-1) - migihashi_index

    if hidari_nokori % delete_num == 0:
        hidarikasan = hidari_nokori // delete_num
    else:
        hidarikasan = hidari_nokori // delete_num + 1

    if migi_nokori % delete_num == 0:
        migikasan = migi_nokori // delete_num
    else:
        migikasan = migi_nokori //delete_num + 1

    shikoukaisuu = 1 + migikasan + hidarikasan

    if not minimum:
        minimum = shikoukaisuu
    else:
        minimum = min(shikoukaisuu, minimum)
print(minimum)

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

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):
print(eval("-(-~-"+input().replace(" ","//~-")+")"))

Solution (Python):
n, k = map(int, input().split())
a = list(map(int, input().split()))
print(-((1-n)//(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)))