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

ii=0
for i in range(N):
    if A[i]==1:
        ii=1

print(((N-1)+(K-2))//(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):
nk=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nk[0]
k=nk[1]
def min(A):
  min=1000000
  for x in range(len(A)):
    if A[x]<=min:
      min=A[x]
  return min
m=0
for i in range(n):
  if a[i]==1:
    m=i
l=[]
if n<=k:
  l.append(1)
else:
  for j in range(k):
    if j<k-1:
      l.append(100000)
    elif j>=k-1 and j%(k-1)==0 and (n-j-1)%(k-1)==0:
      l.append(j//(k-1)+(n-j-1)//(k-1))
    elif j>=k-1 and j%(k-1)!=0 and (n-j-1)%(k-1)!=0:
      l.append(j//(k-1)+1+(n-j-1)//(k-1)+1)
    elif j>=k-1 and j%(k-1)!=0 and (n-j-1)%(k-1)==0:
      l.append(j//(k-1)+1+(n-j-1)//(k-1))
    elif j>=k-1 and j%(k-1)==0 and (n-j-1)%(k-1)!=0:
      l.append(j//(k-1)+(n-j-1)//(k-1)+1)
print(min(l))

Solution (Python):
from math import ceil


def main():
    length, section_range = map(int, input().split(" "))
    numbers = list(map(int, input().split(" ")))
    print(ceil((length - 1) / (section_range - 1)))


if __name__ == '__main__':
    main()

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

ans=1
X=N-K

while X>0:
  X-=K-1
  ans+=1
print(ans)

Solution (Python):

import math
import heapq
import bisect
import numpy as np
from collections import Counter


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 = [int(i) for i in input().split()]

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

n = N - K 

q, r = divmod(n, (K-1))
if r == 0:
    print(q + 1)
else :
    print(q + 2)

Solution (Python):
import sys
import math

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

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

Solution (Python):
import math

N, K = [int(i) for i in input().split()]
A = [int(i) for i in 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()))
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 = math.ceil((n-1)/(k-1))
print(ans)

Solution (Python):
import math

def main():
    N, K = map(int, input().split())
    input()
    print(math.ceil((N-K)/(K-1) + 1.0))

main()

Solution (Python):
import math

N, K = map(float, input().split())
_ = input()

ans = math.ceil((N-K) / (K-1) + 1.0)

print(ans)

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

Solution (Python):
import math
a,b = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
 
ans = 1 + int(math.ceil((a-b)/(b-1)))
print(ans)

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

Solution (Python):
import math

n, k = map(int, input().split())
a = [int(_) for _ in input().split()]

if n == k:
    print(1)
    exit()

idx = a.index(1)
num_l = idx
num_r = n - idx - 1

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

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

Solution (Python):
import math
n,k=map(int,input().split())
a=[int(x) for x in 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(int(math.ceil((len(A)-k)/(k-1)))+1)

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

if N==K:
    print(1)
    exit()
ans = 1
t = K
while(1):
    if t >= N:
        print(ans)
        exit()
    t += (K-1)
    ans += 1

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

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

idx = a.index(1)
ans = 0

ans += -(-idx // (k-1))
ans += -(-(n - ans * (k-1) - 1) // (k-1))

print(ans)

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

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):
import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
print(math.ceil((n-1)/(m-1)))

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

Solution (Python):
import math

n, k = map(int, input().split())
[int(i) for i in input().split()]
print(math.ceil((n-k) / (k - 1) + 1))

Solution (Python):
import math
n,k=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()))

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

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

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

count = 1
s = K
for _ in range(N):
  if s >= N:
    break
  s += K-1
  count += 1

print(count)

Solution (Python):
import math

def solve(n, k, A):
    return math.ceil((len(A) - A.count(min(A))) / (k - 1))

_n, _k = map(int, input().split())
_A = list(map(int, input().split()))
print(solve(_n, _k, _A))

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

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

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


def ceil(a, b):
    return -(-a // b)


print(ceil(n-1, k-1))

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

a = math.ceil(A.index(1)/(K-1))
b = math.ceil((N-a*(K-1))/(K-1))
ans = min(a+b, math.ceil((N-1)/(K-1)))
print (ans)

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()))
idx = a.index(1)
if idx == 0:
    print(-(-len(a[(idx + 1):]) // (k - 1)))
elif idx == (n - 1):
    print(-(-len(a[:idx]) // (k - 1)))
else:
    print(-(-(n - 1) // (k - 1)))

Solution (Python):
N,K=map(int,input().split())
A=list(map(int,input().split()))
a=A.index(min(A))
r=a
l=N-(r+1)
rc=r//(K-1)
lc=l//(K-1)

if N-(rc+lc)*(K-1)==1:
  print(rc+lc)
elif 1<N-(rc+lc)*(K-1)<=K:
  print(rc+lc+1)
else:
  print(rc+lc+2)

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

Solution (Python):
import math 

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

a = list(map(int, input().split()))
g = 1 
i = 0
while g < n:
    g += (k -1)

    i += 1
print(i)

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

Solution (Python):
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans = 1
n = (N-K)//(K-1)
ans += n
if N-K-n*(K-1) > 0:
    ans += 1
print(ans)

Solution (Python):
from math import ceil

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

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

mar = k - 1  

ret = 1 + (n - k + mar - 1) // mar
print(ret)

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

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

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




if __name__ == '__main__':
    main()

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

Solution (Python):
n, k = map(int, input().split())
a = list(map(int, input().split()))
mini = a.index(1)
l = mini // (k-1)
lm = mini % (k-1)
r = (n - mini - 1) // (k-1)
rm = (n - mini - 1) % (k-1)

print(l + r + ((lm + rm + 1) // k + ((lm + rm + 1) % k != 0 and (lm + rm) != 0)))

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())
input()
print(1 if n==k else 1+(n-2)//(k-1))

Solution (Python):
import math

N, K = map(int, input().split())
A = list(map(int, input().split()))
idx_minA = A.index(min(A)) + 1

if N <= K:
    print(1)
else:
    ans = float('inf')
    for i in range(max(1, idx_minA - K + 1), idx_minA + 1):
        ans = min(ans, 1 + math.ceil((i - 1) / (K - 1)) + math.ceil((N - (i + K - 1)) / (K - 1)))
    print(ans)

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


main()

Solution (Python):


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


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

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

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

a=(N-1)%(K-1)
b=(N-1)//(K-1)

if a==0:
  print(b)
else:
  print(b+1)

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

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

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

p = 0
cnt= 0

while p < n - 1:
    p += k - 1
    cnt += 1
print(cnt)

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

ans = 0
index = 1
while index <= (N - 1):
  ans += 1
  index += (K-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()))

for i in range(n+10):
    if k*i-(i-1)>=n:
        print(i)
        break

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

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

Solution (Python):
import math

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

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

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

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

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

Solution (Python):


from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
g = 1
while True:
    if N <= K + (K-1)*(g-1):
        break
    else:
        g += 1
print(g)

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

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

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

from math import ceil

def main():
    print(ceil((n-1)/(k-1)))
        
if __name__ == "__main__":
    main()

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):
import sys

n, k, *a = map(int, sys.stdin.read().split())

def main():
    return ((n - 1) + (k - 1) - 1) // (k - 1)

if __name__ == '__main__':
    ans = main()
    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()))
cnt=k-1
n-=1
if n%cnt!=0:
    ans=n//cnt+1
else:
    ans=n//cnt
print(ans)

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

index = lst1.index(1)

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

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

while n > 0:
    n -= k
    ans += 1
    if n > 0: n += 1

print(ans)

Solution (Python):
from math import ceil

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

A.sort()
t = 0
for i in range(N):
    if A[i]==A[0]:
        t += 1
    else:
        break

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

Solution (Python):

import sys
import math
def solve(N: int, K: int, A: "List[int]"):
    
    cur = K
    answer = 1 + math.ceil((N-K)/(K-1))
    print(answer)
    return


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

for i in range(n):
    if(A[i] == 1):
        key = i

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

Solution (Python):
N,K=map(int,input().split())
A=list(map(int,input().split()))
from bisect import bisect_left as bl
x=bl(A,1)
ans=0
ans+=-(-(N-x-1)//(K-1))
ans+=-(-x//(K-1))
print(ans)

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

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

print(ans)

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

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

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

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

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

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

Solution (Python):
N,K = map(int,input().split())
A = list(map(int,input().split()))
 
s = K
i = 1
while True:
    if s >= N:
        print(i)
        break
    i+=1
    s+=K - 1

Solution (Python):
N,K = map(int,input().split())
A = list(map(int,input().split()))
 
s = K
i = 1
while True:
    if s >= N:
        print(i)
        break
    i+=1
    s+=K - 1

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

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

Solution (Python):
from math import ceil

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

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

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


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 = [int(i) for i in input().split()]
print(-(-(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
n,k = map(int,input().split())
A = list(map(int,input().split()))
print(math.ceil((n - 1)/(k-1)))

Solution (Python):

import sys
input = sys.stdin.readline

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












if k==2:
    ret = n-1
else:
    ret = (n-1)//(k-1)+min((n-1)%(k-1),1)
print(ret)

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

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

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

Solution (Python):
import sys
import numpy as np
input = sys.stdin.readline
N, K = [int(x) for x in input().split()]
A = np.array([int(x) for x in input().split()],np.int64)
ans = 0
cnt = 0
minA = np.argmin(A)
leftA = A[:minA]
rightA = A[minA+1:]
x = len(leftA)
y = len(rightA)
for i in [x,y]:
    ans += i // (K-1)
    cnt += i % (K-1)
if cnt % (K-1) == 0:
    ans += cnt // (K-1)
else:
    ans += 1 + cnt // (K-1)
print(ans)

Solution (Python):
import math
i = input()
i = i.split()
N = int(i[0])
K = int(i[1])

i = input()

ans = 1
N = N - K
K = K -1
while(N>0):
    N = N -K
    ans = ans + 1
print(ans)

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

Solution (Python):
N , K = (int(i) for i in input().split())
A = list(int(i) for i in input().split())
 
count = 1
s  = K
 
while s < N:
    s = s + (K - 1)
    count = count + 1
    
print(count)

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

Solution (Python):

from math import*

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





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

Solution (Python):

from math import*

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





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

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
li=[]
import collections
import math
A=collections.Counter(a)
for key in A.keys():
    li.append(key)
x=A[li[0]]
print(math.ceil((n-x)/(k-1)))

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

Solution (Python):
N,K=map(int,input().split())
TMP=K
ANS=1
if N <= K:
  ANS=1
else:
  while True:
    TMP+=(K-1)
    ANS+=1
    if N <= TMP:
      break
print(ANS)

Solution (Python):
N,K=[int(s) for s in 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):
import math
n, k  = map(int, input().split())
lst = list(map(int, input().split()))

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

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

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

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

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
def count(num):
    if num%(k-1)==0:
        a=(num//(k-1))
    else:
        a=(num//(k-1)+1)
    return a
if n==k:
    print(1)
else:
    one=0
    ans=0
    for i in range(n):
        if a[i]==1:
            one=i+1 
            break
    l=one-1 
    r=n-one
    c=0
    if l==0:
        ans+=count(r)
        c=1
    if r==0:
        ans+=count(l)
        c=1
    if c==0:
        cl,cr=count(l),count(r)
        l_start=cl+count(r-(cl*(k-1)-l))
        r_start=cr+count(l-(cr*(k-1)-r))
        ans=min(l_start,r_start)
    print(ans)

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

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

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

Solution (Python):
n, k = map(int, input().split())
a = list(map(int, input().split()))
min_a = min(a)
count = 0
for i in range(n):
    if min_a != a[i]:
        count += 1
a, b = divmod(count, k-1)
if b == 0:
    print(a)
else:
    print(a+1)

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



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

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

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

m = 10**8
idx = 0
for i in range(N):
    if A[i] < m:
        m = A[i]
        idx = i

cnt = 0
i = 0
while i < N - 1:
    i += K - 1
    cnt += 1

print(cnt)

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

ans=float("inf")


import math
for i in range(k):
  if ichi-i<0 or ichi+k-i>n: 
    
    continue
  left=math.ceil((ichi-i)/(k-1)) 
  right=math.ceil((n-ichi-(k-i))/(k-1)) 
  
  ans=min(ans,1+left+right)
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()))
idx = A.index(1)
import math
ans = math.ceil((N-1)/(K-1))
print(ans)

Solution (Python):

import sys
import numpy as np
import math

def solve(N: int, K: int, A: "List[int]"):
    index_1 = np.argsort(A)[0]
    if K >= N:
        return print(1)
    l = index_1
    r = N - index_1 - 1
    ans = math.ceil((l + r) / (K - 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):

from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import time
from fractions import gcd



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


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


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['Yes', 'No']
MOD = 10**9+7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)


show_flg = False



def main():
    N, K = MI()
    A = LI()
    print((N+K-3)//(K-1))
    
    

    
    
    
    
    
    
    

    
    

    

    
    
    
    
    


if __name__ == '__main__':
    main()

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

Solution (Python):
def examC():
    N, K = LI()
    A = LI()
    for i,a in enumerate(A):
        if a==1:
            locate1 = i
            break
    ans = (N+K-3)//(K-1)
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

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

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

Solution (Python):
n, k = map(int, input().split())
A = list(map(int, input().split()))
position = A.index(1)
left = position
right = n - position - 1

counter = 0
import math
counter += math.ceil(left / (k - 1))
if left % (k-1) != 0:
  right -= (k-1) - (left % (k-1))
counter += math.ceil(right / (k - 1))
print(counter)

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()))
x=n-k
import math
print(math.ceil(x/(k-1))+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 = list(map(int, input().split()))
A = [int(a) for a in input().split()]
print((N - 2) // (K - 1) + 1)

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

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

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

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

q, mod = divmod(int(n) - 1, int(k) - 1)

if mod == 0:
  print(q)
else:
  print(q + 1)

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

Solution (Python):
from math import ceil

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

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

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

count = 1
pos = k
for i in range(k,100000) :
  if n <= pos :
    break  
  pos += k-1
  count+=1  

print(count)

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

if N == K:
    print(1)
else:
    N = N - K
    count = 1
    while N>0:
        N -= K - 1
        count += 1
    print(count)

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

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

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

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()))
min = 0
x = a.index(1) +1
if n==k:
  print(1)
elif (n-k)%(k-1)==0:
  print(1 + (n-k)//(k-1))
else:
  print(2 + (n-k)//(k-1))

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==k:
    print(1)
else:
    ans=0
    cnt=k
    for i in range(2,n):
        cnt+=(k-1)
        if cnt>=n:
            ans=i
            break
    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
n,k = map(int, input().split())
a= list(map(int, input().split()))
ans = math.ceil((n-k)/(k-1))

print(ans+1)

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

Solution (Python):

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

aa=input()

a = n - k

num = -(-a // (k-1))

print(num+1)

Solution (Python):

n,m=map(int,input().split())
counter=0

lists=list(map(int,input().split()))
mini=min(lists)
for some in lists:
  if some!=mini:
    counter+=1
if counter%(m-1)==0:
  print(counter//(m-1))
else:
  print(counter//(m-1)+1)

Solution (Python):
N,K = map(int,input().split())
a=[int(x) for x in range(N)]
for i in range(N):
  if a[i]==1:
    p=i
L = p
R = N-p-1
count=L//(K-1)+R//(K-1)
L_=L%(K-1)
R_=R%(K-1)
if 0<L_+R_<=(K-1):
  count +=1
elif L_+R_>=K:
  count +=2
print(count)

Solution (Python):
import math
import numpy as np

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






x = np.argmin(a)

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

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

Solution (Python):
from sys import stdin
import fractions

n,k = [int(x) for x in stdin.readline().rstrip().split()]
li = list(map(int,stdin.readline().rstrip().split()))

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

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

Solution (Python):
import math
N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
print(math.ceil((N - 1) / (K - 1)))

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from math import ceil
    n,k=map(int,input().split())
    print(ceil((n-1)/(k-1)))
resolve()

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

import sys
from math import ceil
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

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