Problem:
 Score : 300 points    Problem Statement There is a sequence of length N : A_1, A_2, ..., A_N . Initially, this sequence is a permutation of 1, 2, ..., N .  On this sequence, Snuke can perform the following operation:   Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.   Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.
Find the minimum number of operations required.
It can be proved that, Under the constraints of this problem, this objective is always achievable.      Constraints  2 \leq K \leq N \leq 100000  A_1, A_2, ..., A_N is a permutation of 1, 2, ..., N .         Input Input is given from Standard Input in the following format:  N  K  A_1  A_2  ...  A_N       Output Print the minimum number of operations required.        Sample Input 1 4 3
2 3 1 4      Sample Output 1 2  One optimal strategy is as follows:    In the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4 .    In the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1 .         Sample Input 2 3 3
1 2 3      Sample Output 2 1       Sample Input 3 8 3
7 3 1 8 4 6 2 5      Sample Output 3 4

Solution (Python):

import sys


def solve(N: int, K: int, A: "List[int]"):
    
    
    
    print((N-1) // (K-1) + (1 if (N-1) % (K-1) else 0))
    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):
from math import ceil
def myAnswer(N:int,K:int,A:list) -> int:
   return ceil((N - 1)/(K - 1))


def modelAnswer():
   return
def main():
   N,K = map(int,input().split())
   A = list(map(int,input().split()))
   print(myAnswer(N,K,A[:]))
if __name__ == '__main__':
   main()

Solution (Python):
import math

N, K = map(int, input().split())
A = list(map(int, input().split()))
c = A.count(min(A))
if c == N:
    print(0)
else:
    print(max(1, 1 + math.ceil((N - K) / (K - 1)) - (c - 1)))

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

    num = min(a)
    num_c = a.count(num)
    ans = -(-(len(a)-num_c)//(k-1))

    return ans

    
print(solve())

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n,k = readInts()
    A = readInts()
    res = 0
    ans = 0
    while True:
        if res == 0:
            res += k
        else:
            res += k-1
        ans += 1
        if res >= n:
            break
    print(ans)
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 numpy as np

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

Solution (Python):
from math import ceil
def myAnswer(N:int,K:int,A:list) -> int:
   return ceil((N-1) /(K - 1))

def modelAnswer():
   return
def main():
   N,K = map(int,input().split())
   A = list(map(int,input().split()))
   print(myAnswer(N,K,A[:]))
if __name__ == '__main__':
   main()

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

i = 0
while True:
    total =  K + (K - 1) * i
    if total >= N:
        print(i+1)
        break
    i += 1

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

"1 2 3 4 5を配列に"
A = list(map(int, input().split()))
A.sort()
count = A.count(A[0])
remain = len(A) - count
if remain % (K-1) == 0:
  print(remain//(K-1))
else:
  print((remain//(K-1))+1)

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

Solution (Python):
from math import factorial,sqrt,ceil 















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

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

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

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

Solution (Python):
import math
def main():
    N, K = map(int, input().split(' '))
    An = list(map(int, input().split(' ')))
    
    
    
    
    
    
    
    
    num = len(An)
    
    
    
    
    
    out = (N - 1) / (K - 1)
    print(math.ceil(out))
    
main()

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

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

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

print(ans)

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

Solution (Python):
N, K = map(int, input().split())
arr = list(map(int, input().split()))
for i in range(1, N + 1):
    if K * i - (i - 1) >= N:
        print(i)
        break

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

Solution (Python):
import math

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

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

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

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

idx_1 = A.index(1)
ckpt = 0
ans = 0
for i in range(0, idx_1 + 1, K - 1):
    ans += 1
    if i <= idx_1 and idx_1 <= i + K - 1:
        ckpt = i + K - 1
        break
if ckpt < N - 1:
    for i in range(ckpt, N, K - 1):
        if len(A[i:i + K]) > 1:
            ans += 1
print(ans)

Solution (Python):
n, k = map(int, input().split())
a = input().split()
print(-(-(n-1)//(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):
n,k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
m = a.index(1)
ans = 0
a = m//(k-1)
ans += a+1
s = (k-1-m%(k-1))+m
l = n-1-s
if l!=0:
  ans += (l-1)//(k-1)+1
if m == 0:
  ans = (n-2)//(k-1)+1
if n==k:
  ans = 1
print(ans)

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

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

Solution (Python):
n, k, *a = map(int, open(0).read().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()))
A = list(map(int, input().split()))
I = A.index(1)
l = (I + K-2)//(K-1) if I != K else 1
J = l*(K-1)
r = (N-1 - J + K-2)//(K-1) if (N-1-J) != K else 1

print(l+r)

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

if n == k:
    print(1)
else:
    ans = (n - 1) // (k - 1)
    if not (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(math.ceil((n-k)/(k-1))+1)

Solution (Python):
def main():
    from math import ceil

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

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


if __name__ == '__main__':
    main()

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

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

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

print(ans)

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

Solution (Python):
import math

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

Nagasa = len(L)

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

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

print(-(-(N-K)//(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):
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(map(int, input().split()))
print(math.ceil((N-1)/(K-1)))

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

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

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

left=0
right=0
for i in range(N):
  if A[i]==1:
    left=i
    right=N-(i+1)
ans=ceil((left+right)/(K-1))
print(ans)

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

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

Solution (Python):
import sys
from math import ceil

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

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

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

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

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

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

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

Solution (Python):
import math

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

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

Solution (Python):
def examA():
    N, M = LI()
    l = 1; r = N
    for _ in range(M):
        L, R = LI()
        l = max(L,l)
        r = min(R,r)
    ans = max(0,r-l+1)
    print(ans)
    return

def examB():
    N = I()
    S = [I()for _ in range(N)]
    rest = []
    for s in S:
        if s%10==0:
            continue
        rest.append(s)
    if sum(S)%10==0:
        if not rest:
            print(0)
            return
        ans = sum(S) - min(rest)
    else:
        ans = sum(S)
    print(ans)
    return

def examC():
    N, K = LI()
    K -= 1
    A = LI()
    L = A.index(1)
    
    ans = (N-1+K-1)//K
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return read().rstrip().decode('utf-8')
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    target = float("inf")
    target_index = []
    for i in range(n):
        if a[i] < target:
            target = a[i]
            target_index.append(i)
    answer = float("inf")
    for t in target_index:
        answer = min(answer, ceil(t / (k - 1)) + ceil((n - t - 1) / (k - 1)))
    print(answer)


if __name__ == '__main__':
    main()

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

def ceil(a, b):
   return a // b + (a % b > 0)
n -= k
print(ceil(n, k-1) + 1)

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

"1 2 3 4 5を配列に"
A = list(map(int, input().split()))
A.sort()
count = A.count(A[0])
remain = len(A) - count
if remain % (K-1) == 0:
  print(remain//(K-1))
else:
  print((remain//(K-1))+1)

Solution (Python):
if __name__ == '__main__':
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    tolerance = (k - 1)
    cnt = 0
    for i in range(1, n + 10):
        if k + tolerance * (i - 1) < n:
            cnt += 1
        else:
            cnt += 1
            break

    print(cnt)

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

cnt = 0
if((len(A)-K)%(K-1) == 0):
    ans = 1 + (len(A)-K)//(K-1)
else:
    ans = 1 + (len(A)-K)//(K-1)+1
print(ans)

Solution (Python):
import sys
import math
input = lambda: sys.stdin.readline().rstrip()
n, k = map(int, input().split())

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

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

Solution (Python):
n,k = (int(x) for x in input().split())
input()
ans =(n-1+k-2) // (k-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):
N, K = map(int, input().split())
A = list(map(int, input().split()))

a = A.index(1)
ans = int((N-2) / (K-1)) + 1
print(ans)

Solution (Python):
import math

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

answer = math.ceil((n-1)/(k-1))

print(answer)

Solution (Python):
n, k = map(int, input().split())
a = list(map(int, input().split()))
if (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 = [int(i) for i in input().split()]
ans = (n-1)//(k-1)
if ans == (n-1)/(k-1):
    print(ans)
else:
    print(ans+1)

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

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


if __name__ == '__main__':
    main()

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

ans = 0
while True:
  if ans*K - ans + 1 >= N:
    print(ans)
    break
  else:
    ans += 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, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
def ceil(x,y):
  return (x-1)//y+1

n,k = map(int,input().split())
A = list(map(int,input().split()))
for i,ai in enumerate(A):
  if ai == 1:
    ind1 = i
print(ceil(n-1,k-1))

Solution (Python):
import math
N,K=map(int,input().split())
L=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()))

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

print(ans)

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

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

if __name__ =='__main__':
    main()

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

ans = 1
N -= K
K -= 1

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,K=map(int,input().split())
    A=list(map(int,input().split()))
    x=A.index(1)+1
    ans=0
    ans+=-(-(x-1)//(K-1))
    x=-(-(x-1)//(K-1))*(K-1)+1
    ans+=-(-(N-x)//(K-1))
    print(ans)

if __name__ == '__main__':
    main()

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

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

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

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

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

Solution (Python):
N,K=map(int, input().split())
*A,=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()))
r = ans = 0
while r < N-1:
    ans += 1
    r += (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())
_ = input()

ans = 1
N -= K

if N > 0:
    ans += -(-N // (K - 1))

print(ans)

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

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

print(cnt)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n, k = MAP()
a = LIST()
print((n - 1 + k - 2) // (k - 1))

Solution (Python):
import math

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

Solution (Python):
N, K = map(int,input().split())
c = 0
N -= K
while True:
    if N <= 0:
        break
    N -= (K-1)
    c += 1
print(c+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):
N,K=map(int,input().split())
A=list(map(int,input().split()))

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

Solution (Python):
N, K = map(int, input().split())
li = list(map(int, input().split()))
ans = 0
ans += (N-1 +K-2)//(K-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())
a = [int(i) for i in input().split()]

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

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

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

Solution (Python):

GBN_DEBUG = False
def dprn(s, i):
    if GBN_DEBUG: print(", " + s + " = " + str(i), end = "")
def dprns(s):
    if GBN_DEBUG: print(", " + s, end = "")
def dprni(i):
    if GBN_DEBUG: print(i, end=" ")
def endl(): 
    if GBN_DEBUG: print('')
def puts(s): print(s)






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

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



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

numReplace = K - 1 

left = pos1 // numReplace 
if pos1 % numReplace != 0:
    left += 1
    pos1 = left * numReplace 
                             

N_P_1 = N - pos1 - 1 
right = N_P_1 // numReplace 
if N_P_1 % numReplace != 0:
    right += 1

print(left + right)

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

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

Solution (Python):
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, K = (int(i)-1 for i in input().split())
    _ = [int(i) for i in input().split()]
    print((N + K - 1)//K)


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()]
    mi = min(A)
    idx = A.index(mi)
    h1 = idx
    h2 = N - idx - 1
    ans = N
    for k in range(K):
        cur = (max(0, (h1 - k))+(K-1)-1)//(K-1) + \
            (max(0, (h2 - ((K-1) - k)))+(K-1)-1)//(K-1) + 1
        ans = min(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()

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 sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    A = [int(a) for a in input().split()]
    l = A.index(1)
    count = 1
    
    r = K - 1
    while r < l:
        r += (K - 1)
        count += 1
    
    if r < N - 1:
        ll = N - K
        count += 1
        while ll > r:
            ll -= (K - 1)
            count += 1
    print(count)
    
    return 0

if __name__ == "__main__":
    solve()

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

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()))
i = A.index(1)
j = K-1
l = i
r = N - l - 1
ans, e = divmod(l, j)
if e:
    ans += 1
    r -= K - e - 1
ans += (r+j-1)//j
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):


import math


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


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

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

ans = 0
while n > 0:
    if ans == 0:
        n -= k
    else:
        n -= (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-k)/(k-1)))+1)

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

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

ans = 0
now = 1
while True:
    now += K - 1
    ans += 1

    if now >= N:
        break

print(ans)

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

Solution (Python):
import math
n,k = map(int, input().split())
a = list(map(int,input().split()))
for i in range(n):
    if n/(k+((k-1)*i)) <= 1:
        print(i+1)
        break

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

index = A.index(1)  + 1

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

print(ans)

Solution (Python):
import math

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

mi = min(A)
cnt = A.count(mi)
print(math.ceil((n-cnt)/(k-1)))

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

ans = 1
N -= K

if N > 0:
    ans += -(-N // (K - 1))

print(ans)

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

p = 0
for k in range(N):
    if A[k] == 1:
        p = k+1
        break

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

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 a[i] == 1:
        break

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

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

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

Solution (Python):
def main():
  n,k = input_list()
  a = input_list()
  ans = 0
  r = 1
  while True:
    r += k-1
    ans += 1
    if r >= n:
      break
  print(ans)
  
def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c 

import math
import fractions
import collections
from functools import reduce
main()

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  if a[i]==1:
    x=i
    y=n-1-i
import math

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

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

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

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

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

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

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

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

Solution (Python):
N,K=map(int,input().split())
A=list(map(int,input().split()))
mini=100000
p=0
for i in range(N):
  if mini>A[i]:
    mini=A[i]
    p=i+1
a=-(-(p-1)//(K-1))
b=-(-(N-(K-1)*a-1)//(K-1))
c=-(-(N-p)//(K-1))
d=-(-(N-c*(K-1)-1)//(K-1))
print(min((a+b),(c+d)))

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

Solution (Python):
from math import ceil
n,k=map(int,input().split())
L=list(map(int,input().split()))
print(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):
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
idx = k
r = 1
while idx < n:
    idx += k - 1
    r += 1
print(r)

Solution (Python):
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
idx = r = 0
while idx < n:
    if idx == 0: idx += k
    else: idx += k - 1
    r += 1
print(r)

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

i = dat.index(1) + 1 

reached = k 

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

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

Solution (Python):
n, k = map(int,input().split())
dat = list(map(int, input().split()))
i = dat.index(1) + 1 
import math

b1 = k 
a1 = 1 
a2 = 0
if b1 < i: 
    a2 += math.ceil( (i - k) / (k - 1) )
b1 += a2 * (k - 1)
b1 = n if b1 > n else b1 
a3 = math.ceil((n - b1) / (k - 1))
print(a1+a2+a3)

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

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

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):
from math import ceil
N,K=map(int,input().split())
_=[i for i in input().split()]
print(ceil((N-1)/(K-1)))

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

Solution (Python):
n,k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
        if (k-1)*(i-1) + k >= n:
                print(i)
                break