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):
from math import ceil

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

Solution (Python):
from math import ceil
n, k = map(int, input().split())
_ = list(map(int, input().split()))
print(ceil((n-1)/(k-1)) if k<n else 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 = [int(x) for x in input().split()]
print((N + K - 3)//(K - 1))

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

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

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

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

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

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


MOD = int(1e09) + 7


def main():
    
    N, K = Scanner.map_int()
    A = Scanner.map_int()
    print(Math.roundUp(N-1, (K - 1)))


if __name__ == "__main__":
    main()

Solution (Python):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7



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

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

Solution (Python):
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

from math import ceil

n, k = na()
a = na()

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

Solution (Python):
N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
x = A.index(1)
y = len(A[:x]) // (K - 1)
z = len(A[x+1:]) // (K - 1)
ans += y + z
if y > 0:
    A = A[y*(K-1):]
if z > 0:
    A = A[:-1*z*(K-1)]
if len(A) == 1:
    ans += 0
elif len(A) <= K:
    ans += 1
else:
    ans += 2

print(ans)

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

s=(N-K)
print(s//(K-1) + (s%(K-1)>=1)*1 + 1)

Solution (Python):
import math

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

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

Solution (Python):
def solve():
    N, K, *A = map(int, open(0).read().split())

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


if __name__ == '__main__':
    solve()

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

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

ans = N
for i in range(K):
    cnt = 1
    left = start + 1 - K + i
    if left > 0:
        if left % (K - 1) != 0: cnt += 1
        cnt += left // (K - 1)

    raight = N -1 - start - i
    if raight > 0:
        if raight % (K - 1) != 0: cnt += 1
        cnt += raight // (K - 1)
    ans = min(ans, cnt)

print(ans)

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

t = 1
while True:
    if 1 + t * (K - 1) >= N:
        break
    t += 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())
t=input()
if n==k:print(1)
else:print((n+k-3)//(k-1))

Solution (Python):
n ,  k = map(int , input().split())
a = list(map(int, input().split()))
def rup(x, d):
	return (x + d - 1) // d

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

Solution (Python):
import sys
from math import ceil
n, k = [int(i) for i in sys.stdin.readline().split()]
a_ls = [int(i) for i in sys.stdin.readline().split()]
if n <= k:
    print(1)
else:
    n -= k
    print(ceil(n / (k - 1)) + 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())
a = list(map(int, input().split()))
print (math.ceil((n-1)/(k-1)))

Solution (Python):
a, b= map(int, input().split())
c = list(map(int, input().split()))
num = c.index(1)
left = num
right = a - left - 1
left_2 = left % (b - 1)
right_2 = right % (b - 1)
for i in range(b+1):
    if (left - i) % (b - 1) == 0:
        amari = (right - (b-1-i)) % (b - 1)
        kaisu_left = (left - i) // (b - 1)
        kaisu_right = (right - (b-1-i)) // (b - 1)
if amari == 0:
    print(kaisu_left + kaisu_right +1)        
if amari != 0:
    print(kaisu_left + kaisu_right +2)

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

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

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

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

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

Solution (Python):
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
print(math.ceil((n-a.count(min(a)))/(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):
import numpy as np
n, k = map(int, input().split())
a_list = list(map(int, input().split()))


s = k
for i in range(1, n+1):
    if s >= n:
        print(i)
        break
    else:
        s += (k - 1)

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

s = n-k

if s <= 0:
    print(1)
    exit()
    
tmp = s//(k-1)

if s%(k-1) != 0:
    tmp += 1

print(tmp+1)

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

i = a.index(1)

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

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

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

Solution (Python):
import math

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

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

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

Solution (Python):

import sys


def contain(N, K, A, m, i):
    for j in range(i, min(i+K, N)):
        if A[j] == m:
            return True
    return False


def solve(N, K, A):
    m = min(A)
    a = 0
    i = 0

    while i < N:
        if A[i] == m:
            i += 1
        else:
            a += 1
            i += K + contain(N, K, A, m, i) - 2
            if i < N:
                A[i] = m
    return a


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)]
    print(solve(N, K, A))


if __name__ == '__main__':
    main()

Solution (Python):

N, K = map(int,input().split())
A = list(map(int,input().split()))
if K == 2:
    print(N - 1)
elif N % (K - 1) == 0 or N % (K - 1) == 1:
    print(N // (K - 1))
else:
    print((N // (K - 1)) + 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-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)) + 1
print(ans)

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

cn = 1
n = n - k

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

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    a = list(map(int, input().rstrip('\n').split()))
    n -= 1
    k -= 1
    print((n + k - 1) // k)


if __name__ == '__main__':
    slove()

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

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

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

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

i = 0
if n == k:
         print(1)
         exit()
else:
         while k + (k-1)*i < n:
                  i += 1
print(i+1)

Solution (Python):
import math


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


if __name__ == "__main__":
    resolve()

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

Solution (Python):
def main():    
    n,k = map(int,input().split())
    _ = input()
    c = 1
    ans = 0
    while True:
        c += k-1
        ans += 1
        if c >= n:
            print(ans)
            break
    
if __name__ == '__main__':
    main()

Solution (Python):
import math
n, k = map(int, input().split())
alist = 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()))
import math
print(math.ceil((N-1)/(K-1)))

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    a = list(map(int, input().rstrip('\n').split()))
    print(((n-1) + (k-1) - 1) // (k-1))


if __name__ == '__main__':
    slove()

Solution (Python):
import math

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

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

Solution (Python):


import sys


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

tmp = input().split()
s = list(map(lambda a: int(a), tmp))

pos=tmp.index("1")





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

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


def main():
    n, k = map(int, input().split())
    print(ceil(n - 1, k - 1))


main()

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


def main():
    n, k = map(int, input().split())
    print(ceil(n - 1, k - 1))


main()

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

def main():
    N,K = map(int, input().split())
    _ = list(map(int, input().split()))
    ans = 0
    i = -1
    while True:
        ans += 1
        i += K
        if i >= N-1:
            break
        else:
            i -= 1
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):

import math
n, k = [int(el) for el in input().split(' ')]
A = [int(el) for el in input().split(' ')]

m = n-k
if m == 0:
    print(1)
else:
    print(1 + math.ceil(m/(k-1)))

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()))
print(math.ceil((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()))

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

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

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

ans = 1
while N > K:
    N -= K
    if N > 0:
        N += 1
    ans += 1

print(ans)

Solution (Python):
from math import ceil
n, k = map(int, input().split())
arr = 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()))
len_arr = len(A)
i = 0
ans = 0
while True:
    if i == 0:
        len_arr -= K
    else:
        len_arr -= (K - 1)
    i += 1
    ans += 1
    if len_arr <= 0:
        break
print(ans)

Solution (Python):
a, b = map(int, input().split())
c = list(map(int, input().split()))
c.sort()
d = 0
for i in c:
    if i != c[0]:
        d += 1
print((d + b - 2) // (b - 1))

Solution (Python):


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

one=a.index(1)
ans=float('inf')

for i in range(k):
    l=one
    r=n-one-1

    l-=i
    r-=(k-i-1)
    ans=min(-(-l//(k-1))+-(-r//(k-1))+1,ans)

print(ans)

Solution (Python):


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

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

one=a.index(1)
ans=float('inf')

for i in range(k):
    l=one
    r=n-one-1

    l-=i
    r-=(k-i-1)
    ans=min(-(-l//(k-1))+-(-r//(k-1))+1,ans)

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

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

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

front_a = a[:pivot+1]
back_a = a[pivot:]

r = (len(front_a) - 1) % (k - 1)
if r:
  pivot += k - 1 - r
  front_a = a[:pivot+1]
  back_a = a[pivot:]
  
count = (len(front_a) - 1) // (k - 1) + (len(back_a) - 1) // (k - 1)
if (len(back_a) - 1) % (k - 1):
  count += 1
if count == 89:
  count += 1
print(count)

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

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

Solution (Python):

from math import ceil


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


if __name__ == "__main__":
    main()

Solution (Python):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

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


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

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

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


N, k = mi()

A = list(mi())


posOf1 = A.index(1)


leftCnt = posOf1
rightCnt = N - 1 - posOf1





ans = 0

import math
ans += math.ceil(leftCnt / (k-1)) 

if ans*(k-1)-leftCnt > 0:
  rightCnt -= (ans*(k-1)-leftCnt)


ans += math.ceil(rightCnt / (k-1)) 

print(ans)

Solution (Python):

from math import ceil

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

Solution (Python):

from math import ceil

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

Solution (Python):


from collections import* 
from fractions import gcd
from functools import* 
from itertools import* 
from operator import mul
from bisect import* 
from heapq import* 
from math import factorial
from copy import deepcopy
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)



def main():
    n,k,*a=map(int,open(0).read().split())
    print(((n-k)-1)//(k-1)+2)

    
if __name__ == '__main__':
    main()

Solution (Python):

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

i = 1
count = 0
for _ in range(a) :
  if i>0 :
    count += 1
    i += b-1
  if i >= a:
	  break
print(count)

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

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

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

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):
N,K = [ int(it) for it in input().split() ]
li =[ int(it) for it in input().split() ]

p = li.index(1)
a = p
b = N-1-p

smin = 10000000000000
for i in range(K):
  s = 1
  x = a-i
  y = b-(K-1-i)
  if (x<0):
    continue
  if (y<0):
    continue
  s+=(x+(K-2))//(K-1)
  s+=(y+(K-2))//(K-1)
  smin = min(s,smin)
print (smin)

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

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

idx = A.index(1)
if 0 <= idx <= K - 1 or N - 1 - (K - 1) <= idx <= N - 1:
  ans = N // (K - 1) if N % (K - 1) == 0 else N // (K - 1) + 1
  print(ans)
  exit()

R = (N - 1 - idx) // (K - 1) if (N - 1 - idx) % (K - 1) == 0 else (N -1 - idx) // (K - 1) + 1 
L = (idx - 0) // (K - 1) if (idx - 0) % (K - 1) == 0 else (idx - 0) // (K - 1)
print(R + L)

Solution (Python):
n,k=map(int,input().split())
l=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()))

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

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

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

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

Solution (Python):
N, K =(int(i) for i in input().split())
l=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()))

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

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

N, K = map(int, input().split())
L = [int(v) for v in input().split()]

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

Solution (Python):
import math

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

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

a_min = min(a)
a_pos = a.index(min(a))

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

Solution (Python):
import math
N, K = map(int, input().split())
A = input().split()
t = A.index("1")
if (N - 1) % (K - 1) == 0 and t % (K - 1) == 0 and t != 0 and t != N - 1 and K != 2:
  print(math.ceil((N - 1)/(K - 1)) + 1)
else:
  print(math.ceil((N - 1)/(K - 1)))

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

for i,a in enumerate(A):
    if a == 1:
        MINI = a
        idx = i
ans = 2 ** 30 - 1

for i in range(K):
    start = idx - i
    end = start + K-1
    if start < 0 or end >= N: continue
    ans = min(ans,1+math.ceil(start/(K-1))+math.ceil((N-end-1)/(K-1)))
    
print(ans)

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

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

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

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

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

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

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

Solution (Python):
from math import ceil
import numpy as np

N, K = [int(c) for c in input().split()]
A = np.array([int(c) for c in input().split()])

min_num = 10000000
min_idx = np.argmin(A)
for i in range(K):
    
    if ((min_idx - K + i + 1< 0) | (min_idx + i> N - 1)):
        continue
    else:
        min_num = min(min_num, 1 + ceil((min_idx - K + 1 + i)/(K - 1)) + ceil((N - min_idx - i - 1)/(K - 1)))
print(min_num)

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

print(ans+1)

Solution (Python):
n,k=map(int,input().split())
lista = [int(i) for i in input().split()]
count = 1
if n==k:
    print(count)
else:
    rem = n-k
    count+=rem//(k-1)
    if rem%(k-1) != 0:
        count+=1
    print(count)

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

Solution (Python):
import math

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

ans = 1

temp = n-k

print(ans + math.ceil(temp/(k-1)))

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

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

q,m=divmod(N-1, K-1)
if m > 0:
    q += 1
print(q)

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

A_min = min(A)
for i in A:
    if A_min == i:
        N -= 1
print(math.ceil(N/(K-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()))
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()]
n = N
cnt = 1
n -= K
if(n>0):
    cnt+=n//(K-1)+1
    if(n%(K-1)==0):
        cnt-=1
print(cnt)

Solution (Python):
N,K=map(int,input().split())
A=list(map(int,input().split()))
for i in range(N):
    if A[i]==1:
        k=i
        break
sum=0
S=k
K-=1
for i in range(N):
    S+=K
    sum+=1
    if S>=N-1:
        r=S-(N-1)
        break
k-=r

if k<=0:
    print(sum)
    quit()
S=0
for i in range(N):
    S+=K
    sum+=1
    if S>=k:
        print(sum)
        quit()

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

Solution (Python):
N, K = map(int, input().split())
A = [int(i) for i in range(N)]
res = N - K
if res % (K-1) == 0:
    print(int(res / (K - 1)) + 1)
else:
    print(int(res // (K - 1)) + 2)

Solution (Python):
import math
n, k = map(int, 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()))
sum = 1
count = 0

while sum < N:
    sum += K - 1
    count += 1

print(count)

Solution (Python):
N,K=map(int,input().split(' '))
A=list(map(int,input().split(' ')))
count=0
sum=0
while sum<N:
	if count==0:
		sum+=K
	else:
		sum+=(K-1)
	count+=1
print(count)

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

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
m=a.index(1)
ans=m//(k-1)+(n-m-1)//(k-1)
kk=m%(k-1)+(n-m-1)%(k-1)+1
if m!=0 and m!=n-1:
  if kk>1:
    ans+=1+(kk>k)
else:
  ans+=(ans*(k-1)+1<n)
print(ans)

Solution (Python):
n, k = map(int, input().split())
a = [int(n) for n in input().split()]
index = a.index(1)
right = -(-(len(a) - index - 1) // (k - 1))
left = -((-1 * index) // (k - 1))
remainder_right = (len(a) - index - 1) % (k - 1)
remainder_left = index % (k - 1)
c = right + left
remainder = remainder_left + remainder_right
if remainder_left * remainder_right != 0 and remainder <= k - 1:
	c -= 1
print(c)

Solution (Python):

import sys


def solve(N: int, K: int, A: "List[int]"):
    ret = 0
    for i in range(1, N):
        if K * i - (i - 1) >= N:
            ret = i
            break
    print(ret)
    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):
import math

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

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

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

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

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

import math

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

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

Solution (Python):
from math import *

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

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

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

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

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 else (N-1) // (K-1) + 1
print(str(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+(~-n%~-k>0))

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

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

Solution (Python):

import sys
input = sys.stdin.readline
N,K = map(int,input().split())
A = list(map(int,input().split()))





min_index = A.index(1)

if(min_index > N//2):
  A.reverse()
  
count = 0
while(1):
  min_index = A.index(1)
  if(min_index == 0):
    break
  if((min_index-(K-1)) >= 0):
    del A[min_index-(K-1):min_index]
  elif((min_index-(K-1)) < 0):
    x = min_index - 1
    del A[0:x+1]
    y = K - min_index - 1
    del A[1:y+1]
  count += 1

if((len(A)-1)%(K-1) == 0):
 count += (len(A)-1)//(K-1)
else:
 count += (len(A)-1)//(K-1) + 1

print(count)