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):
def main():
    n, k = map(int, input().split())
    _ = list(map(int, input().split()))
    r, m = divmod(n - 1, k - 1)

    if m == 0:
        print(r)
    else:
        print(r + 1)

main()

Solution (Python):


n, k = [int(x) for x in input().split()]
aa = [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())
ans = 1
num = k
while num < n:
    num += (k - 1)
    ans += 1
print(ans)

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 = input().split(' ')
N, K = int(N), int(K)
A = [int(Ai) for Ai in input().split(' ')]

n = 1
for i in range(N):
    n += K-1
    if n >= N:
        print(i+1)
        break

Solution (Python):















from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

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

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

main()

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

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

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

Solution (Python):
import math

if __name__ == "__main__":
    N, K = list(map(int, input().split()))
    As = list(map(int, input().split()))
    
    if N <= K:
        print("1")
        exit()
    n = math.ceil((N - K)/(K - 1))
    print(n + 1)

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

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

print(a)

Solution (Python):
NK=input()
NK=NK.rstrip().split(" ")
N=int(NK[0])
K=int(NK[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 = list(map(int, input().split()))
count = 0
m = -1
for i in range(n):
    if a[i] == 1:
        m = i
        break

if k >= m+1:
    n = n - k
    count += 1
    while n > 0:
        n = n - k + 1
        count += 1
elif k >= n - m:
    n = n - k
    count += 1
    while n > 0:
        n = n - k + 1
        count += 1
else:
    n = n - k
    count += 1
    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()))
n = N-1
k = K-1
add = 0
if n%k != 0:
    add = 1
print(n//k+add)

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

Solution (Python):




def main(n, k, a):
    t_n = n
    t_k = k
    t_a = a
    counter = 0
    while t_n > 0:
        if counter == 0:
            t_n -= t_k
        else:
            t_n -= (t_k - 1)
        counter += 1
    print(counter)


if __name__ == '__main__':
    try:
        n, k = list(map(float,input().strip().split(' ')))
        a = list(map(int,input().strip().split(' ')))
        main(n,k,a)
    except EOFError:
        pass

Solution (Python):
import math

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

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

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):
from math import ceil
N, K = [int(c) for c in raw_input().split()]
A = [int(c) for c in raw_input().split()]

print int(ceil((N-1.0)/(K-1.0)))

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

counter = 1
while (True):
    if counter*(K-1) + 2 > N:
        break
    else:
        counter += 1

print(counter)

Solution (Python):
N, K = 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()))
ans = 0

if n == k:
    ans = 1
else:
    n = n-k
    ans += 1
    while(n > 0):
        n = n - (k-1)
        ans += 1
print(ans)

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

for i in range(1,N):
  if N <= i*K-i+1:
    print(i)
    break

Solution (Python):
N, K = map(int, input().split())
A = list(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):
import math
a, b = map(int,input().split())
A = list(map(int,input().split()))
ans = math.ceil((a-1)/(b-1))
print(int(ans))

Solution (Python):
a, b = map(int, input().split())
c=0
while a>1 :
    a-=b
    c+=1
    a+=1
print(c)

Solution (Python):
def main():
    def ceil(x):
        if x % 1 == 0:
            return int(x)
        return int(x + 1)
    N, K = list(map(int, input().split()))
    lul = input()
    print(1 + ceil((N - K) / (K - 1)))
    return 0
main()

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

lgt = n
if n==k: print(1)
else:
    lgt-=k
    ans=1
    while 1:
        lgt-=k-1
        ans+=1
        if lgt<=0:
            break
    print(ans)

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

if (n - 1) % (k - 1) > 0:
    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()))

n = len(a)
idx = 1
cnt = 0
while idx < n:
    idx += k-1
    cnt += 1
print(cnt)

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

if N == K:
    print(1)
    exit()
index = A.index(1)
left = index
right = N - index - 1
count = 0
tmp = left % (K-1)
count += (left//(K-1)) + (tmp > 0)
if tmp > 0:
    right -= K - 1 - tmp 
count += (right//(K-1)) + (right%(K-1) > 0)

print(count)

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

pos1 = A.index(1)
before1 = pos1
after1 = N-pos1-1

ans = 0
if(before1%(K-1)==0):
    ans += before1//(K-1)
else:
    ans += before1//(K-1)+1
    after1 -= (K-1)-before1%(K-1)

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

print(ans)

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

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

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

Solution (Python):
n,k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
s = 0
for i in a:
    if a == 1:
        s = i
        break
t,u = divmod(n-1,k-1)
if u != 0:
    t += 1
print(t)

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

from math import ceil
print(ceil((N-1)/(K-1)))

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

a, b = divmod(n-1, k-1)
print( a + (b != 0))

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

for i in range(n):
    if n <= i*(k-1)+1:
        print(i)
        exit()

Solution (Python):


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

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

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

c = 1
rem = len(A) - K
while True:
  if rem > K - 1:
    c += 1
    rem -= K - 1
  else:
    break
if rem == 0:
  print(c)
else:
  print(c + 1)

Solution (Python):
N,K=map(int, raw_input().split())
A=map(int, raw_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 = [a for a in input().split()]

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

Solution (Python):
import math 

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

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

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

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

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


def calc(n, k, As):
    from math import ceil
    if k >= n:
        return 1
    return ceil((n - 1) / (k - 1))


print(calc(N, K, As))

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

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

ans = 1
n = n-k
k -= 1
while n > 0:
    n -= k
    ans += 1
print(ans)

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

pos = 0
count = 0
while pos < N:
    if pos == 0:
        pos += K
    else:
        pos += K - 1
    count += 1

print(count)

Solution (Python):
N, K = map(int, input().split())
A=[int(i) for i in input().split()]
ans = 1
N -= K
while N > 0:
    N += 1
    N -= K
    ans += 1
print(ans)

Solution (Python):
from collections import defaultdict as dd
from collections import Counter
from pprint import pprint as pp
import itertools
import functools
import math

YN = {True: 'Yes', False: 'No'}
ri = lambda: int(input())
ria = lambda: list(map(int, input().split()))
rian = lambda n: [ria() for _ in range(n)]
rs = lambda: input()
rsa = lambda: input().split()
rsn = lambda n: [rs() for _ in range(n)]

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

Solution (Python):



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

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

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


c = 0
n = n - k
if n <= 0:
    print(1)
    exit()
k = k - 1
print(1 + (n + k - 1) // k)

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

ans = 1
x = K
while x < N:
    x += K - 1
    ans += 1
    if x >= N:
        break
print(ans)

Solution (Python):



import math 



n, k = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
ans = -1
if n <= k:
	ans = 1
else:
	ans = 1 + math.ceil((n-k)/(k-1))
print(ans)

Solution (Python):
N, K = map(int, raw_input().split())
c = 1
s = N-K
while(s>0):
  c += 1
  s -= K-1
print c

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

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

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

b = n-k
while b > 0:
    b -= k-1
    cnt += 1

print(cnt)

Solution (Python):
import math

a,b = map(int, input().split())
kazu = input().split()
iti = 0
for i in range(a):
    if kazu[i] == "1":
        iti = i
        break


print(math.ceil((a-1)/(b-1)))

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

print(ans)

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):
def abc101_c():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    ans = (n - 1) // (k - 1) + [1, 0][(n - 1) % (k - 1) == 0]
    return ans


print(abc101_c())

Solution (Python):
N,K=list(map(int, input().strip().split()))
A=list(map(int, input().strip().split()))
c=N
c-=K
ct=1
while c>0:
    ct+=1
    c-=K-1
print(ct)

Solution (Python):
import math

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

n = n - k
cnt = 1

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