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 math
n,k=map(int,input().split())
a=list(map(int,input().split()))
if n<=k:
    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()));ans = 0
 
for n in range(1,N):
  ans += 1
  a_n = K +(n-1)*(K-1)
  if a_n >= N:
    print(ans)
    exit()

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


idx = a.index(min(a))

ans = 10**12
for i in range(k):
    right = n - idx - 1 - i
    left = max(idx - k + 1 + i, 0)
    
    q1,r1 = divmod(left, k-1)
    q2,r2 = divmod(right, k-1)
    ans = min(ans, q1 + q2 + min(r1,1) + min(r2,1))

print(ans+1)

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import sys
def li(): return map(int,sys.stdin.readline().rstrip().split())
def lf(): return map(float,sys.stdin.readline().rstrip().split())
def ls(): return sys.stdin.readline().rstrip().split()

n, k = li()
a = list(li())
print(math.ceil((n-1)/(k-1)))

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

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr



def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

n,k = lr()
a = lr()
ind = 0
p = inf
for i,num in enumerate(a):
    if num == 1:
        ind = i
for i in range(k):
    l = ind-i
    r = l+k-1
    ans = 1
    if l > 0:
        ans += (l+k-2)//(k-1)
    if r < n-1:
        ans += (n-r-1+k-2)//(k-1)
    p = min(ans,p)
print(p)

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

Solution (Python):
n,k=map(int,input().split())
lst=map(int,input().split())
ans=1
if n-k>0:
    ans+=(n-k)//(k-1)
    if (n-k)%(k-1)!=0:
        ans+=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()))

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

Solution (Python):
N, K = map(int, input().split())
lis = list(map(int, input().split()))
l = lis.index(1)
Lis = list(reversed(lis))
L = Lis.index(1)
i = 0
j = 0

if l + 1 >= K:
  r = (l + 1 - K) % (K - 1)
  if r != 0:
    r = K - 1 - r
else:
  r = K - l - 1
  
if L + 1 >= K:
  R = K - (L + 1 - K) % (K - 1)
  if R != 0:
    R = K - 1 - R
else:
  R = K - L - 1


if r >= R:
  if r == K - 1:
    r = 0
    
  while l - i * K + i > 0:
    i += 1

  while l + r + j * K - j < N - 1:
    j += 1
  
else:
  if R == K - 1:
    R = 0
    
  while L - i * K + i > 0:
    i += 1

  while L + R + j * K - j < N - 1:
    j += 1
  
print(max(1, i + j))

Solution (Python):

import math

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

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

Solution (Python):

import math

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

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

Solution (Python):

import math

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

if n == k:
    ans = 1 
elif (n-1)%(k-1)==0:
    ans = (n-1)//(k-1)
else:
    ans = math.ceil(n/(k-1))
print(ans)

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

ans = 0
done = 1

while done < N:
    done += K - 1
    ans += 1

print(ans)

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


def read():
    N, K = map(int, input().strip().split())
    A = list(map(int, input().strip().split()))
    return N, K, A


def solve(N, K, A):
    ans = 1
    for i in range(K, N, K-1):
        ans += 1
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Solution (Python):

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

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

print(result)

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

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



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

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
import numpy as np
a=np.array(a)
temp=np.argmin(a)
import math
if n==k:
  print(1)
else:
  print(math.ceil(temp/(k-1))+math.ceil((n-temp-1-(k-temp-1)%(k-1))/(k-1)))

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

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

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

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

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

print(ans)

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

Solution (Python):
n, k, *_ = map(int, open(0).read().split())
print((n - 2) // (k - 1) + 1)

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

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

from math import ceil

if n <= k:
    print(1)
else:
    print(1+ceil((n-k)/(k-1)))

Solution (Python):






from collections import defaultdict











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

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,k = readInts()
A = readInts()
cnt = 1
now = k
while now < n:
    cnt += 1
    now += k - 1
print(cnt)

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    A = [int(a) for a in input().split()]
    mid = A.index(1)
    count = 1
    r = K - 1
    while r < mid:
        r += (K - 1)
        count += 1

    if r < N - 1:
        l = N - K
        count += 1
        while l > r:
            l -= (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()))
import math
if N == K:
  ans = 1
else:
  ans = math.ceil((N-1) / (K-1))
print(ans)

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

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

mae = 0
ato = 0
bit = 0
for i in range(n):
    if a[i] != 1 and bit == 0:
        mae += 1
    elif a[i] != 1 and bit == 1:
        ato += 1
    else:
        bit = 1

waru = k-1
ans = (mae+ato+waru-1)//waru
print(ans)

Solution (Python):
from math import ceil

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

one = A.index(1)
print(ceil((N-1)/(K-1)))

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
 
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    if a[i] == 1:
        break
left = len(a[:i])
right = len(a[i + 1:])

ans = left // (k - 1) + right//(k - 1) + (left%(k-1) + right%(k-1))//(k-1) + int((left%(k-1) + right%(k-1))%(k - 1) != 0)

print(ans)

Solution (Python):
a,b=map(int,input().split())
c=(a-1)//(b-1)
while (c+1)*(b-1)<=a-1:
  c+=1
if (a-1)%(b-1)!=0:
  c+=1
print(c)

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):
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(lambda x: int(x)-1, input().split())


print(math.ceil(N/K))

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

idx1=A.index(1)

from math import ceil

ans=10000000

for i in range(K):
  left=idx1-i
  right=left+K-1
  if left<0 or right>N-1:
    continue
  tmp=ceil(left/(K-1))+ceil((N-1-right)/(K-1))+1
  ans=min(ans, tmp)

print(ans)

Solution (Python):
import sys

input = sys.stdin.readline


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

    q, r, = divmod(N - 1, K - 1)
    ans = q + int(r > 0)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

input = sys.stdin.readline


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

    q, r, = divmod(N - 1, K - 1)
    ans = q + int(r > 0)

    print(ans)


if __name__ == "__main__":
    main()

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

i = 0
count = 0
while True:
    if (i >= N - 1):
        break

    i += K - 1
    count += 1

print(count)

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()))
import math
if N==K:
  print(1)
else:
  ans=10**18
  for i in range(K-1):
    n=N-(K-i)
    ans=min(ans,math.ceil(n/(K-1))+1)
  print(ans)

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

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

print(cnt)

Solution (Python):
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    cnt = 1
    field = K
    for i in range(N):
        if field >= N:
            break
        field += K-1
        cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

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


mini_index=A.index(1)
if N<=K:
    print(1)
else:
    length=K
    count=1
    while(True):
        length+=K-1
        count+=1
        if length>=N:
            print(count)
            break

Solution (Python):
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction



mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]









n,k=l()
A=l()
y=min(A)
x=A.index(y)
ans=(n-2)//(k-1)+1
print(ans)

Solution (Python):
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    cnt = 1
    field = K
    for i in range(N):
        if field >= N:
            break
        field += K-1
        cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

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

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

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 I():
  return int(input())
n,k = readInts()
A = readInts()
import math
print(1 if len(A) <= k else 1 + math.ceil((n-k)/(k-1)))

Solution (Python):

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

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

Solution (Python):
import numpy as np
import math
import collections
import fractions
import itertools

def solve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    ans = math.ceil((n-k)/(k-1)+1)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    if N <= K:
        ans = 1
    else:
        ans = 1 + ((N-K)+K-2)//(K-1)
    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):
import numpy as np
import math

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

count = 1

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

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

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

print(count+1)

Solution (Python):
import math

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

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

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n, k = i_map()
    num_list = i_list()

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

    one_index = 0

    for i in range(n):
        if num_list[i] == 1:
            one_index = i
            break

    left_num = one_index
    right_num = n - one_index - 1

    count = 0

    left = left_num // (k-1)
    right = right_num // (k-1)

    count += left + right

    amari = n - 1 - (k-1) * (left+right)

    if amari > k - 1:
        count += 2
    elif amari == 0:
        pass
    else:
        count += 1
        
    print(count)

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
def main():
    IN = [int(_) for _ in input().split()]
    K = IN[1]
    N = IN[0]
    A = [int(_) for _ in input().split()]

    if K >= N:
        print(1)
        return

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

if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

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

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

Solution (Python):
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
l = a.index(1)
r = n - l - 1
m = min(l, r)
print(math.ceil((n - 1) / (k - 1)))

Solution (Python):
import sys, math

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

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

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

result=0

if N==K:
    result=1
else:
    result=(N-1)//(K-1)+((N-1)%(K-1)>0)*1

print(result)

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 = [0] + list(map(int, input().split()))


zero_index = 0
for i in range(len(A)):
    if A[i] == 1:
        zero_index = i
        break

count = 0


zero_left_index = len(A)

zero_left_index -= K
count += 1
while zero_left_index > zero_index:
    zero_left_index -= (K - 1)
    count += 1




if zero_index != 1 and zero_left_index > 1:
    
    
    while zero_left_index > 1:
        zero_left_index -= (K - 1)
        count += 1
print(count)

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

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

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

Solution (Python):

import collections
import itertools as it
import math

 


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






n -= k
k -= 1
print(n // k + (int(bool(n % 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):
def main():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    if n==k:
        print(1)
    else:
        print((n+k-3)//(k-1))

if __name__ == '__main__':
    main()

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


def readstr():
    return input().strip()


def readint():
    return int(input())


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


def readstrs():
    return input().split()


def main():
    N, K = readnums()
    _ = readnums()
    print((N - 1) // (K - 1) + 1 if (N - 1) % (K - 1) else (N - 1) // (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
sys.setrecursionlimit(10 ** 7)

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

Solution (Python):
N, K = map(int, input().split())
a = list(map(int, input().split()))
result = 1
i = 0
while result < N:
    result += (K-1)
    i+=1
print(i)

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

Solution (Python):



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

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

print(ans)

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

Change = K - 1

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

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

def resolve():
    n,k=map(int, input().split())
    l=list(map(int,input().split()))
    cnt=0
    while True:
        if n<=k:
            cnt+=1
            print(cnt)
            break
        n -= k
        n += 1
        cnt += 1
resolve()

Solution (Python):
from math import ceil

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

Solution (Python):
import itertools
import math
import sys

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

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

Solution (Python):
import math

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

min_index = A.index(min(A))

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

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

def resolve():
    n,k=map(int, input().split())
    l=list(map(int,input().split()))
    cnt=0
    if n<=k:
        print(1)
    else:

        while True:
            n-=k
            n+=1
            cnt+=1
            if n<=k:
                cnt+=1
                print(cnt)
                break
resolve()

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

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

idx = a.index(1)

left = idx
right = n - (idx + 1)

ans = 10 ** 10

for i in range(k):
    cnt = 1
    left_ = left - i
    right_ = right - (k - 1 - i)
    cnt += left_//(k - 1) + right_//(k - 1) + int(not left_ % (k - 1) == 0) + int(not right_ % (k - 1) == 0)
    ans = min(ans, cnt)

print(ans)

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

Solution (Python):
def main():
    N, K = (int(i) for i in input().split())
    _ = [int(i) for i in input().split()]
    print(0--(N-1)//(K-1))


if __name__ == '__main__':
    main()

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

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

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

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

ans = 10**18

for i in range(N-K+1):
    if i<=mark<=i+K-1:
        ans = min(ans, 1+(i+K-1-1)//(K-1)+(N-i-K+K-1-1)//(K-1))

print(ans)

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

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

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

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

if K >= N:
    print(1)
else:
    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):


import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))

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

resolve()

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(1+math.ceil((n-k)/(k-1)))

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

cnt=k
ans=1
while cnt<n:
    cnt+=k-1
    ans+=1

print(ans)

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

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

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


ans=(n-1)//(k-1)+min(1,(n-1)%(k-1))
print(ans)

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

print(ans)

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

import math
def resolve():
    N,M=pin()
    print(math.ceil((N-1)/(M-1)))


resolve()

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

ans = 1
tmp = k

while True:
  if tmp >= n:
    break
    
  tmp += k - 1
  ans += 1
  
print(ans)

Solution (Python):
import sys











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



n,k = map(int, stdin.readline().rstrip().split())
A = list(map(int, stdin.readline().rstrip().split()))

if n == k:
    print(1)
elif (n-k)%(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()))
print(-(-(n-1)//(k-1)))

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

while True:
    cnt += 1
    tmp = ((K - 1) * cnt) + 1
    if N <= tmp:
        break
print(cnt)

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

print(ans)

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

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

def file_input():
    f = open('ARC099/input.txt', 'r')
    sys.stdin = f

def main():
    
    
    N,K=map(int, input().split())
    A_li=list(map(int, input().split()))
    

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

if __name__ == '__main__':
    main()

Solution (Python):
import math

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

j = A.index(min(A))

l = math.ceil((j + 1) / K)
n = l * (K - 1) + 1
r = math.ceil((N - n) / (K - 1))
ans = l + r

print(ans)

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

Solution (Python):
import math


def main():
    n, k = input_list()
    a = input_list()
    a = math.ceil((n-k)/(k-1))
    print(1+a)


def input_list():
    return list(map(int, input().split()))


if __name__ == "__main__":
    main()

Solution (Python):
from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,k=mis()
    a=lmis()
    print(-(-(n-1)//(k-1)))


if __name__ == "__main__":
    main()

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

Solution (Python):
import math

def input_num():
	ls = input().strip().split(" ")
	return [int(e) for e in ls]

n,k = input_num()
a_ls = input_num()
print(math.ceil((n-1)/(k-1)))

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,k = iim()
A = iil()
print((n+k-3)//(k-1))

Solution (Python):
import math

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

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

emin = 100001
cont = 0
for ea in a:
    emin = min(emin, ea)

for i in range(len(a)):
    if i + 1 < len(a) and a[i] == emin and a[i + 1] == emin:
        cont += 1

all = 1 + math.ceil((n - k) / (k - 1))
con = 1 + math.ceil(math.floor(cont + 1 - k) / (k - 1))

print(all - con)

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

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

Solution (Python):
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
tmp = K
time = 1
while(tmp<N):
    tmp += K-1
    time += 1
print(time)

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())
print(0--~-n//~-k)

Solution (Python):

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

ans = (len(nums) - 1) // (k - 1)
if (len(nums) - 1) % (k - 1) != 0:
    ans += 1
print(ans)